Re: Win32 fix for pg_dumpall - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Win32 fix for pg_dumpall
Date
Msg-id 200408160246.i7G2kwU24638@candle.pha.pa.us
Whole thread Raw
In response to Re: Win32 fix for pg_dumpall  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >               /*
> >                *    We emulate fgets() behaviour. So if there is no newline
> >                *    at the end, we add one...
> >                */
> > !             if (line[len-1] != '\n')
> >                   strcat(line,"\n");
> >           }
>
> This is untrustworthy if len is zero.  Perhaps
>
>             if (len == 0 || line[len-1] != '\n')
>                 strcat(line,"\n");

Agreed, fixed.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add GUC_REPORT to server_encoding, integer_datetimes
Next
From: Bruce Momjian
Date:
Subject: Re: fix schema ownership on first connection preliminary