summaryrefslogtreecommitdiff
path: root/package/tcp_wrappers/patches/patch-percent_m_c
blob: 524b63204d673254603b1edc27abc5015399d283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- tcp_wrappers_7.6.orig/percent_m.c	1994-12-28 17:42:37.000000000 +0100
+++ tcp_wrappers_7.6/percent_m.c	2009-06-05 18:45:03.000000000 +0200
@@ -13,7 +13,7 @@ static char sccsid[] = "@(#) percent_m.c
 #include <string.h>
 
 extern int errno;
-#ifndef SYS_ERRLIST_DEFINED
+#if !defined(SYS_ERRLIST_DEFINED) && !defined(HAVE_STRERROR)
 extern char *sys_errlist[];
 extern int sys_nerr;
 #endif
@@ -29,11 +29,15 @@ char   *ibuf;
 
     while (*bp = *cp)
 	if (*cp == '%' && cp[1] == 'm') {
+#ifdef HAVE_STRERROR
+            strcpy(bp, strerror(errno));
+#else
 	    if (errno < sys_nerr && errno > 0) {
 		strcpy(bp, sys_errlist[errno]);
 	    } else {
 		sprintf(bp, "Unknown error %d", errno);
 	    }
+#endif
 	    bp += strlen(bp);
 	    cp += 2;
 	} else {