mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Remove rangechecks on errno; just call strerror unconditionally. This
eliminates a raft of portability issues, including whether sys_nerr exists, whether the platform has any valid negative errnos, etc. The downside is minimal: errno shouldn't ever contain an invalid value anyway, and if it does, reasonably modern versions of strerror will not choke. This rangecheck idea seemed good at the time, but it's clearly a net loss, and I apologize to all concerned for having ever put it in.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.78 2001/01/21 00:59:26 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.79 2001/01/22 23:28:52 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -43,10 +43,6 @@
|
||||
|
||||
extern int errno;
|
||||
|
||||
#ifdef HAVE_SYS_NERR
|
||||
extern int sys_nerr;
|
||||
#endif
|
||||
|
||||
extern CommandDest whereToSendOutput;
|
||||
|
||||
#ifdef ENABLE_SYSLOG
|
||||
@ -139,14 +135,7 @@ elog(int lev, const char *fmt, ...)
|
||||
return; /* ignore debug msgs if noplace to send */
|
||||
|
||||
/* Save error str before calling any function that might change errno */
|
||||
if (errno >= 0
|
||||
#ifdef HAVE_SYS_NERR
|
||||
&& errno <= sys_nerr
|
||||
#endif
|
||||
)
|
||||
errorstr = strerror(errno);
|
||||
else
|
||||
errorstr = NULL;
|
||||
errorstr = strerror(errno);
|
||||
/*
|
||||
* Some strerror()s return an empty string for out-of-range errno.
|
||||
* This is ANSI C spec compliant, but not exactly useful.
|
||||
|
Reference in New Issue
Block a user