diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-12-14 00:12:10 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-12-14 00:12:10 +0000 |
commit | dfb68e343668b6b2938791db80fe38b70ab96db7 (patch) | |
tree | 64ef5e146223a321c6d4960aa365db172609857e /gcc/gcc.c | |
parent | 04e167f417d38da0dac3ca5af19c40144ad81e13 (diff) | |
download | gcc-dfb68e343668b6b2938791db80fe38b70ab96db7.tar.gz |
(my_strerror): Return "cannot access" if errno is 0.
(perror_with_name, pfatal_with_name, perror_exec): Don't assume that
the returned value from my_strerror contains no '%'s.
(sys_nerr): Declare only if HAVE_STRERROR is not defined.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10714 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c index d90969870d1..d19d11e928f 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -175,8 +175,8 @@ extern char *getenv (); extern int errno; #endif -extern int sys_nerr; #ifndef HAVE_STRERROR +extern int sys_nerr; #if defined(bsd4_4) extern const char *const sys_errlist[]; #else @@ -1023,7 +1023,7 @@ my_strerror(e) static char buffer[30]; if (!e) - return ""; + return "cannot access"; if (e > 0 && e < sys_nerr) return sys_errlist[e]; @@ -4722,40 +4722,22 @@ static void pfatal_with_name (name) char *name; { - char *s; - - if (errno < sys_nerr) - s = concat ("%s: ", my_strerror( errno )); - else - s = "cannot open `%s'"; - fatal (s, name); + fatal ("%s: %s", name, my_strerror (errno)); } static void perror_with_name (name) char *name; { - char *s; - - if (errno < sys_nerr) - s = concat ("%s: ", my_strerror( errno )); - else - s = "cannot open `%s'"; - error (s, name); + error ("%s: %s", name, my_strerror (errno)); } static void perror_exec (name) char *name; { - char *s; - - if (errno < sys_nerr) - s = concat ("installation problem, cannot exec `%s': ", - my_strerror (errno)); - else - s = "installation problem, cannot exec `%s'"; - error (s, name); + error ("installation problem, cannot exec `%s': %s", + name, my_strerror (errno)); } /* More 'friendly' abort that prints the line and file. |