This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Some of the gdbserver code has trouble on Linux with GNU libc 2.1 because it redeclares sys_errlist in a way that conflicts with the library headers. Since libiberty provides strerror on platforms that don't have it, we might as well make use of it. 1999-04-11 Philip Blundell <philb@gnu.org> * gdbserver/utils.c (perror_with_name): Use strerror rather than sys_errlist. Include <errno.h>, don't declare errno directly. * gdbserver/gdbreplay.c (perror_with_name): Likewise. diff -u --recursive --new-file /home/phil/gdb/clean/gdb-4.17/gdb/gdbserver/gdbreplay.c gdb/gdbserver/gdbreplay.c --- /home/phil/gdb/clean/gdb-4.17/gdb/gdbserver/gdbreplay.c Sun Apr 11 21:57:15 1999 +++ gdb/gdbserver/gdbreplay.c Sun Apr 11 19:16:26 1999 @@ -27,6 +27,7 @@ #include <signal.h> #include <ctype.h> #include <fcntl.h> +#include <errno.h> /* Sort of a hack... */ #define EOL (EOF - 1) @@ -41,20 +42,15 @@ perror_with_name (string) char *string; { - extern int sys_nerr; - extern char *sys_errlist[]; - extern int errno; - char *err; + char *err = strerror (errno); char *combined; - err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error"; combined = (char *) alloca (strlen (err) + strlen (string) + 3); strcpy (combined, string); strcat (combined, ": "); strcat (combined, err); - fprintf (stderr, "\n%s.\n", combined); - fflush (stderr); - exit (1); + + error ("%s.", combined); } static void diff -u --recursive --new-file /home/phil/gdb/clean/gdb-4.17/gdb/gdbserver/utils.c gdb/gdbserver/utils.c --- /home/phil/gdb/clean/gdb-4.17/gdb/gdbserver/utils.c Sat Aug 9 05:49:48 1997 +++ gdb/gdbserver/utils.c Sun Apr 11 15:34:56 1999 @@ -20,6 +20,7 @@ #include "server.h" #include <stdio.h> #include <string.h> +#include <errno.h> /* Generally useful subroutines used throughout the program. */ @@ -31,16 +32,8 @@ perror_with_name (string) char *string; { - extern int sys_nerr; - extern char *sys_errlist[]; - extern int errno; - char *err; + char *err = strerror (errno); char *combined; - - if (errno < sys_nerr) - err = sys_errlist[errno]; - else - err = "unknown error"; combined = (char *) alloca (strlen (err) + strlen (string) + 3); strcpy (combined, string);