OSDN Git Service

This is an attempt to get rid of some cruft...
authorMarc G. Fournier <scrappy@hub.org>
Tue, 18 Mar 1997 21:40:41 +0000 (21:40 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Tue, 18 Mar 1997 21:40:41 +0000 (21:40 +0000)
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

src/backend/utils/error/elog.c
src/backend/utils/error/exc.c

index a82d4d2..8ea3b3c 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 const char *cp;
     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
     extern     FILE    *Pfout;
 #endif /* !PG_STANDALONE */
@@ -104,7 +97,7 @@ elog(int lev, const char *fmt, ... )
     for (cp = fmt; *cp; cp++)
        if (*cp == '%' && *(cp+1) == 'm') {
            if (errno < sys_nerr && errno >= 0)
-               strcpy(bp, sys_errlist[errno]);
+               strcpy(bp, strerror(errno));
            else
                sprintf(bp, "error %d", errno);
            bp += strlen(bp);
index fddb7bb..a3d71be 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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
  *    XXX this code needs improvement--check for state violations and
@@ -93,13 +93,6 @@ ExcPrint(Exception *excP,
 {
     extern     int     errno;
     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
     data = data;
@@ -125,9 +118,8 @@ ExcPrint(Exception *excP,
     
     (void) fprintf(stderr, " (%ld)", detail);
     
-    if (errno > 0 && errno < sys_nerr &&
-       sys_errlist[errno] != NULL && sys_errlist[errno][0] != '\0')
-       (void) fprintf(stderr, " [%s]", sys_errlist[errno]);
+    if (errno > 0 && errno < sys_nerr) 
+       (void) fprintf(stderr, " [%s]", strerror(errno));
     else if (errno != 0)
        (void) fprintf(stderr, " [Error %d]", errno);