Print this page
1666 libwrap is 32bit only
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Garrett D'Amore <garrett.damore@dey-sys.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libwrap/percent_m.c
+++ new/usr/src/lib/libwrap/percent_m.c
1 1 /*
2 2 * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 */
5 -#pragma ident "%Z%%M% %I% %E% SMI"
6 -
7 5 /*
8 6 * Replace %m by system error message.
9 7 *
10 8 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
11 9 */
12 10
13 11 #ifndef lint
14 12 static char sccsid[] = "@(#) percent_m.c 1.1 94/12/28 17:42:37";
15 13 #endif
16 14
17 15 #include <stdio.h>
18 16 #include <errno.h>
19 17 #include <string.h>
20 18
21 19 extern int errno;
22 -#ifndef SYS_ERRLIST_DEFINED
23 -extern char *sys_errlist[];
24 -extern int sys_nerr;
25 -#endif
26 20
27 21 #include "mystdarg.h"
28 22
29 23 char *percent_m(obuf, ibuf)
30 24 char *obuf;
31 25 char *ibuf;
32 26 {
33 27 char *bp = obuf;
34 28 char *cp = ibuf;
35 29
36 30 while (*bp = *cp)
37 31 if (*cp == '%' && cp[1] == 'm') {
38 - if (errno < sys_nerr && errno > 0) {
39 - strcpy(bp, sys_errlist[errno]);
40 - } else {
41 - sprintf(bp, "Unknown error %d", errno);
42 - }
32 + strcpy(bp, strerror(errno));
43 33 bp += strlen(bp);
44 34 cp += 2;
45 35 } else {
46 36 bp++, cp++;
47 37 }
48 38 return (obuf);
49 39 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX