1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +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

@@ -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]);
}