fix syslog

This commit is contained in:
Mario Fetka 2023-05-31 19:06:51 +02:00
parent 7bd5845990
commit 1b91c1effe
2 changed files with 10 additions and 33 deletions

View File

@ -40,8 +40,8 @@
typedef unsigned char uint8;
typedef unsigned short int uint16;
typedef unsigned long int uint32;
/* typedef unsigned int uint32; */
/* typedef unsigned long int uint32; */
typedef unsigned int uint32;
#define IPX_NET_SIZE 4
#define IPX_NODE_SIZE 6

View File

@ -21,27 +21,6 @@
#include <stdarg.h>
#include <syslog.h>
#if 0
#ifndef LINUX
extern int _sys_nerr;
extern char *_sys_errlist[];
#else
# ifndef __USE_GNU
# define _sys_nerr sys_nerr
# define _sys_errlist sys_errlist
# endif
#endif
#else
# ifndef __USE_GNU
# ifdef FREEBSD
# define _sys_nerr sys_nerr
# define _sys_errlist sys_errlist
# else
extern int _sys_nerr;
extern char *_sys_errlist[];
# endif
# endif
#endif
int nw_debug=0;
uint32 debug_mask=0; /* special debug masks */
@ -182,8 +161,7 @@ static char *buffered=NULL;
if (mode & 0x10) {
int l=sprintf(pb, ", errno=%d", errnum);
pb+=l;
if (errnum > 0 && errnum < _sys_nerr)
l=sprintf(pb, " (%s)", _sys_errlist[errnum]);
l=sprintf(pb, " (%s)", strerror(errnum));
}
if (!(mode & 2)) {
char identstr[200];
@ -208,9 +186,8 @@ static char *buffered=NULL;
va_end(ap);
}
if (mode & 0x10) {
fprintf(logfile, ", errno=%d", errnum);
if (errnum > 0 && errnum < _sys_nerr)
fprintf(logfile, " (%s)", _sys_errlist[errnum]);
fprintf(logfile, ", errno=%d", strerror(errnum));
fprintf(logfile, " (%s)", strerror(errnum));
}
if (!(mode & 2))
fprintf(logfile, "\n");
@ -236,11 +213,11 @@ void errorp(int mode, char *what, char *p, ...)
errnum = -1;
mode -= 10;
}
if (errnum >= 0 && errnum < _sys_nerr) errstr = _sys_errlist[errnum];
else if (errnum > -1)
sprintf(errbuf, "errno=%d", errnum);
else
errbuf[0] = '\0';
// if (errnum >= 0 && errnum < _sys_nerr) errstr = _sys_errlist[errnum];
// else if (errnum > -1)
sprintf(errbuf, "errno=%d", strerror(errnum));
// else
// errbuf[0] = '\0';
if (use_syslog) {
int prio=(mode) ? LOG_CRIT : LOG_ERR;