1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-29 13:56:47 +03:00

This is an attempt to get rid of some cruft...

According to man page under FreeBSD for sys_errlist[], strerror() should be
used instead...not sure if this will break other systems, so only changing
two files for now, and we'll see what "errors" it turns up
This commit is contained in:
Marc G. Fournier 1997-03-18 21:40:41 +00:00
parent dcd2332a4d
commit d611b07dd7
2 changed files with 5 additions and 20 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.14 1997/03/18 21:30:39 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.15 1997/03/18 21:40:39 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -47,13 +47,6 @@ elog(int lev, const char *fmt, ... )
register char *bp; register char *bp;
register const char *cp; register const char *cp;
extern int errno, sys_nerr; extern int errno, sys_nerr;
#if !defined(BSD44_derived) && \
!defined(bsdi) && \
!defined(bsdi_2_1) && \
!defined(linuxalpha) && \
!defined(__GLIBC__)
extern char *sys_errlist[];
#endif /* bsd derived */
#ifndef PG_STANDALONE #ifndef PG_STANDALONE
extern FILE *Pfout; extern FILE *Pfout;
#endif /* !PG_STANDALONE */ #endif /* !PG_STANDALONE */
@ -104,7 +97,7 @@ elog(int lev, const char *fmt, ... )
for (cp = fmt; *cp; cp++) for (cp = fmt; *cp; cp++)
if (*cp == '%' && *(cp+1) == 'm') { if (*cp == '%' && *(cp+1) == 'm') {
if (errno < sys_nerr && errno >= 0) if (errno < sys_nerr && errno >= 0)
strcpy(bp, sys_errlist[errno]); strcpy(bp, strerror(errno));
else else
sprintf(bp, "error %d", errno); sprintf(bp, "error %d", errno);
bp += strlen(bp); bp += strlen(bp);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.11 1997/03/18 21:30:41 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.12 1997/03/18 21:40:41 scrappy Exp $
* *
* NOTE * NOTE
* XXX this code needs improvement--check for state violations and * XXX this code needs improvement--check for state violations and
@ -93,13 +93,6 @@ ExcPrint(Exception *excP,
{ {
extern int errno; extern int errno;
extern int sys_nerr; extern int sys_nerr;
#if !defined(BSD44_derived) && \
!defined(bsdi) && \
!defined(bsdi_2_1) && \
!defined(linuxalpha) && \
!defined(__GLIBC__)
extern char *sys_errlist[];
#endif /* ! bsd_derived */
#ifdef lint #ifdef lint
data = data; data = data;
@ -125,9 +118,8 @@ ExcPrint(Exception *excP,
(void) fprintf(stderr, " (%ld)", detail); (void) fprintf(stderr, " (%ld)", detail);
if (errno > 0 && errno < sys_nerr && if (errno > 0 && errno < sys_nerr)
sys_errlist[errno] != NULL && sys_errlist[errno][0] != '\0') (void) fprintf(stderr, " [%s]", strerror(errno));
(void) fprintf(stderr, " [%s]", sys_errlist[errno]);
else if (errno != 0) else if (errno != 0)
(void) fprintf(stderr, " [Error %d]", errno); (void) fprintf(stderr, " [Error %d]", errno);