From: Eric Andersen Date: Wed, 20 Aug 2003 14:57:21 +0000 (-0000) Subject: fix all uses of sys_nerr and sys_errlist[] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=772128bd40162c51a7a7f6fe7074660fdc83a48d;p=buildroot.git fix all uses of sys_nerr and sys_errlist[] --- diff --git a/sources/gdb.patch b/sources/gdb.patch index e7868a1726..e44b15ccdf 100644 --- a/sources/gdb.patch +++ b/sources/gdb.patch @@ -498,9 +498,114 @@ Fix build on Sparc. #include #else #include ---- gdb-5.3/gdb/gdbserver/utils.c.orig 2003-08-20 08:34:18.000000000 -0600 -+++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:35:00.000000000 -0600 -@@ -40,9 +40,8 @@ +diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c +--- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c 2002-07-09 11:38:58.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/gdbreplay.c 2003-08-20 08:44:20.000000000 -0600 +@@ -54,14 +54,15 @@ + perror_with_name (char *string) + { + #ifndef STDC_HEADERS +- extern int sys_nerr; + extern char *sys_errlist[]; + extern int errno; + #endif + const char *err; + char *combined; + +- err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error"; ++ err = strerror (errno); ++ if (err == NULL) ++ err = "unknown error"; + combined = (char *) alloca (strlen (err) + strlen (string) + 3); + strcpy (combined, string); + strcat (combined, ": "); +diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c +--- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-hppabsd.c 2003-08-20 08:46:04.000000000 -0600 +@@ -61,7 +61,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c +--- gdb-5.3/gdb/gdbserver.orig/low-lynx.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-lynx.c 2003-08-20 08:46:18.000000000 -0600 +@@ -79,7 +79,7 @@ + + fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n", + getpid (), program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c +--- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c 2002-01-17 14:13:49.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-nbsd.c 2003-08-20 08:46:27.000000000 -0600 +@@ -137,7 +137,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c +--- gdb-5.3/gdb/gdbserver.orig/low-sparc.c 2002-01-17 14:13:50.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-sparc.c 2003-08-20 08:46:38.000000000 -0600 +@@ -44,7 +44,6 @@ + #include + #include + +-extern int sys_nerr; + extern char **sys_errlist; + extern int errno; + +@@ -67,7 +66,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c +--- gdb-5.3/gdb/gdbserver.orig/low-sun3.c 2002-01-17 14:13:50.000000000 -0700 ++++ gdb-5.3/gdb/gdbserver/low-sun3.c 2003-08-20 08:46:51.000000000 -0600 +@@ -41,7 +41,6 @@ + #include + #include + +-extern int sys_nerr; + extern char **sys_errlist; + extern int errno; + +@@ -64,7 +63,7 @@ + execv (program, allargs); + + fprintf (stderr, "Cannot exec %s: %s.\n", program, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error"); ++ strerror (errno)); + fflush (stderr); + _exit (0177); + } +diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c +--- gdb-5.3/gdb/gdbserver.orig/utils.c 2003-08-20 08:47:56.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:48:15.000000000 -0600 +@@ -33,16 +33,13 @@ + perror_with_name (char *string) + { + #ifndef STDC_HEADERS +- extern int sys_nerr; +- extern char *sys_errlist[]; + extern int errno; + #endif const char *err; char *combined; @@ -512,3 +617,17 @@ Fix build on Sparc. err = "unknown error"; combined = (char *) alloca (strlen (err) + strlen (string) + 3); +diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig +--- gdb-5.3/gdb/gdbserver.orig/linux-low.c 2003-08-20 08:40:27.000000000 -0600 ++++ gdb-5.3/gdb/gdbserver/linux-low.c 2003-08-20 08:44:54.000000000 -0600 +@@ -175,8 +175,7 @@ + if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0) + { + fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid, +- errno < sys_nerr ? sys_errlist[errno] : "unknown error", +- errno); ++ strerror (errno), errno); + fflush (stderr); + + /* If we fail to attach to an LWP, just return. */ +