Re: [HACKERS] CVS tip problems

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: olly(at)lfix(dot)co(dot)uk, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] CVS tip problems
Date: 2004-06-07 22:46:30
Message-ID: 200406072246.i57MkU911096@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-06-07 23:00:51 Re: [HACKERS] CVS tip problems
Previous Message Tom Lane 2004-06-07 22:45:07 Re: [HACKERS] CVS tip problems

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-06-07 23:00:51 Re: [HACKERS] CVS tip problems
Previous Message Tom Lane 2004-06-07 22:45:07 Re: [HACKERS] CVS tip problems