mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-16 13:53:22 +02:00
06e1d62689
The first rule of portability for us is 'thou shalt have no other gods before c.h', and a whole lot of these files were either not including c.h at all, or including random system headers beforehand, either of which sins can mess up largefile support nicely. Once you have included c.h, there is no need to re-include what it includes, either.
31 lines
557 B
C
31 lines
557 B
C
/* $PostgreSQL: pgsql/src/port/strerror.c,v 1.5 2005/07/28 04:03:14 tgl Exp $ */
|
|
|
|
/*
|
|
* 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 "c.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, _("unrecognized error %d"), errnum);
|
|
return buf;
|
|
}
|
|
|
|
return sys_errlist[errnum];
|
|
}
|