Re: OID from insert has extra letter - Mailing list pgsql-hackers

From Ross J. Reedstrom
Subject Re: OID from insert has extra letter
Date
Msg-id 20010206121004.B19218@rice.edu
Whole thread Raw
In response to Re: OID from insert has extra letter  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: OID from insert has extra letter  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Mon, Feb 05, 2001 at 09:17:45PM -0500, Tom Lane wrote:
> 
> Yes, on looking at it I see that someone broke PQoidStatus() in 7.0.
> If you want to fix your copy, the patch (line numbers are for current
> CVS) is
> 
> Index: fe-exec.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v
> retrieving revision 1.98
> retrieving revision 1.100
> diff -c -r1.98 -r1.100
> *** fe-exec.c    2001/01/24 19:43:30    1.98
> --- fe-exec.c    2001/02/06 02:02:27    1.100
> ***************
> *** 2035,2041 ****
>       if (len > 23)
>           len = 23;
>       strncpy(buf, res->cmdStatus + 7, len);
> !     buf[23] = '\0';
>   
>       return buf;
>   }
> --- 2035,2041 ----
>       if (len > 23)
>           len = 23;
>       strncpy(buf, res->cmdStatus + 7, len);
> !     buf[len] = '\0';
>   
>       return buf;
>   }
> 

Hmm, is there some undocumented feature of strncpy that I don't know
about, where it modifies the passed length variable (which would be hard,
since it's pass by value)? Otherwise, doesn't this patch just replace
the constant '23' with the variable 'len', set to 23?

Ross


pgsql-hackers by date:

Previous
From: "Oliver Elphick"
Date:
Subject: Include files for SPI are not installed
Next
From: Karel Zak
Date:
Subject: Re: Include files for SPI are not installed