linamh/net-fs/mars-nwe/files/mars-nwe-syslog.patch

70 lines
1.9 KiB
Diff
Raw Normal View History

2022-11-19 21:49:12 +01:00
--- mars_nwe-0.99.pl23/src/tools.c.orig 2013-11-05 11:16:48.000000000 +0100
+++ mars_nwe-0.99.pl23/src/tools.c 2022-11-03 12:39:31.800751433 +0100
@@ -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 @@
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 @@
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 @@
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;