1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Add a check for strerr, and add in D'Arcy's strerror() code in case not

found
This commit is contained in:
Marc G. Fournier
1997-03-19 02:37:42 +00:00
parent da9dcf826b
commit 6ffd26d8eb
5 changed files with 99 additions and 15 deletions

View File

@@ -19,7 +19,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.2 1997/02/28 10:57:47 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.3 1997/03/19 02:33:29 scrappy Exp $
#
#-------------------------------------------------------------------------
@@ -31,7 +31,7 @@ ifndef PORTNAME
@false
else
OBJS = $(PORTNAME)/SUBSYS.o @INET_ATON@
OBJS = $(PORTNAME)/SUBSYS.o @INET_ATON@ @STRERROR@
all: submake SUBSYS.o

View File

@@ -0,0 +1,30 @@
/*
* strerror - map error number to descriptive string
*
* This version is obviously somewhat Unix-specific.
*
* based on code by Henry Spencer
* modified for ANSI by D'Arcy J.M. Cain
*/
#include <string.h>
#include <stdio.h>
#include <errno.h>
extern const char * const sys_errlist[];
extern int sys_nerr;
const char *
strerror(int errnum)
{
static char buf[24];
if (errnum < 0 || errnum > sys_nerr)
{
sprintf(buf, "unknown error %d", errnum);
return(buf);
}
return(sys_errlist[errnum]);
}