Re: OID from insert has extra letter

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: OID from insert has extra letter
Дата
Msg-id 20010206121004.B19218@rice.edu
обсуждение исходный текст
Ответ на Re: OID from insert has extra letter  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: OID from insert has extra letter  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Oliver Elphick"
Дата:
Сообщение: Include files for SPI are not installed
Следующее
От: Karel Zak
Дата:
Сообщение: Re: Include files for SPI are not installed