Re: [HACKERS] CVS tip problems - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] CVS tip problems
Date
Msg-id 200406072246.i57MkU911096@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] CVS tip problems  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] CVS tip problems
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > ! #ifdef STRERROR_R_INT
> > !     /* SUSv3 version */
> > !     if (strerror_r(errnum, strerrbuf, buflen) == 0)
> > !         return strerrbuf;
> > !     else
> > !         return NULL;
> > ! #else
>
> This code will dump core if strerror_r ever fails, which seems like
> a bad idea.  I suggest that it be like
>
> !     if (strerror_r(errnum, strerrbuf, buflen) == 0)
> !         return strerrbuf;
> !     else
> !         return "strerror_r failed";
>
> which at least gives a hint of the problem ...

I assume all the callers have to check for NULL, rather than supply a
dummy string.  However, are you saying that this is more of a debug tool
and should never fail to return a usable value?

--
  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: [HACKERS] CVS tip problems
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] CVS tip problems