Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> 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
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to