summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-01-08 16:44:19 +0000
committerJim Meyering <jim@meyering.net>2000-01-08 16:44:19 +0000
commit58edea6508b349d0fe08a1966444f156476c8d0f (patch)
tree1eeee55b2728f57610486c49380280553126b102 /lib
parentd15ab2c1bec511502152e0b27d23f0052a662157 (diff)
downloadcoreutils-58edea6508b349d0fe08a1966444f156476c8d0f.tar.xz
(error): Use __strerror_r's return value only if HAVE_WORKING_STRERROR_R.
(error_at_line): Likewise.
Diffstat (limited to 'lib')
-rw-r--r--lib/error.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/error.c b/lib/error.c
index 53b650c57..676ce1d68 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990,91,92,93,94,95,96,97,98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -150,12 +150,16 @@ error (status, errnum, message, va_alist)
++error_message_count;
if (errnum)
{
-#if defined HAVE_STRERROR_R || defined _LIBC
+#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
+# if HAVE_WORKING_STRERROR_R || _LIBC
+ fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
+# else
/* Don't use __strerror_r's return value because on some systems
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
__strerror_r (errnum, errbuf, sizeof errbuf);
fprintf (stderr, ": %s", errbuf);
+# endif
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
@@ -230,10 +234,14 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
+# if HAVE_WORKING_STRERROR_R || _LIBC
+ fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
+# else
/* Don't use __strerror_r's return value because on some systems
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
__strerror_r (errnum, errbuf, sizeof errbuf);
fprintf (stderr, ": %s", errbuf);
+# endif
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif