use-strerror-if-available-20030725
authorDerrick Brashear <shadow@dementia.org>
Fri, 25 Jul 2003 05:38:01 +0000 (05:38 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 25 Jul 2003 05:38:01 +0000 (05:38 +0000)
discover and use strerror instead of sys_errlist and sys_nerr.

acinclude.m4
src/pinstall/install.c

index 903dd97..170c6f6 100644 (file)
@@ -798,7 +798,7 @@ fi
 AC_SUBST(HAVE_PAM)
 
 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec)
-AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf)
+AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror)
 AC_CHECK_TYPE(ssize_t, int)
 AC_SIZEOF_TYPE(long)
 
index bcd8beb..d7fc61b 100644 (file)
@@ -91,15 +91,20 @@ RCSID
 static struct stat istat, ostat;
 static int stripcalled = 0;
 
-#if !defined(AFS_DARWIN60_ENV) && !defined(AFS_FBSD50_ENV)
+/* How many systems don't have strerror now? */
+#ifndef HAVE_STRERROR
+#if !defined(AFS_DARWIN60_ENV) && !defined(AFS_FBSD50_ENV) 
 extern int sys_nerr;
 #endif
 #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
 extern char *sys_errlist[];
 #endif
+char *ErrorString(int aerrno);
+#else
+#define ErrorString strerror
+#endif
 
 /* static prototypes */
-char *ErrorString(int aerrno);
 int stripName(char *aname);
 int atoo(register char *astr);
 
@@ -132,6 +137,7 @@ strrpbrk(char *s, char *set)
     return 0;
 }
 
+#ifndef HAVE_STRERROR
 char *
 ErrorString(int aerrno)
 {
@@ -143,6 +149,7 @@ ErrorString(int aerrno)
     }
     return tbuffer;
 }
+#endif
 
 int
 stripName(char *aname)