Re: OID from insert has extra letter

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: OID from insert has extra letter
Date: 2001-02-06 18:10:04
Message-ID: 20010206121004.B19218@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2001-02-06 18:17:47 Re: Include files for SPI are not installed
Previous Message Oliver Elphick 2001-02-06 17:58:07 Include files for SPI are not installed