diff options
author | Nick Clifton <nickc@redhat.com> | 2003-11-07 12:19:34 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-11-07 12:19:34 +0000 |
commit | f24ddbddc5177a930b867626b12d2bb8b3757223 (patch) | |
tree | fe1b8c0703b20b4e188b7c432488a7e2f8874ab1 /binutils/readelf.c | |
parent | 65ed7f0a337f0c802f4a7c096c833f20c99dfb3e (diff) | |
download | gdb-f24ddbddc5177a930b867626b12d2bb8b3757223.zip gdb-f24ddbddc5177a930b867626b12d2bb8b3757223.tar.gz gdb-f24ddbddc5177a930b867626b12d2bb8b3757223.tar.bz2 |
Use consistent error messages for missing files.
Detect directories where an ordinary file is expected.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index fb8d80f..9b8b12e 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -10457,14 +10457,24 @@ process_file (char *file_name) if (stat (file_name, &statbuf) < 0) { - error (_("Cannot stat input file %s.\n"), file_name); + if (errno == ENOENT) + error (_("'%s': No such file\n"), file_name); + else + error (_("Could not locate '%s'. System error message: %s\n"), + file_name, strerror (errno)); + return 1; + } + + if (! S_ISREG (statbuf.st_mode)) + { + error (_("'%s' is not an ordinary file\n"), file_name); return 1; } file = fopen (file_name, "rb"); if (file == NULL) { - error (_("Input file %s not found.\n"), file_name); + error (_("Input file '%s' is not readable.\n"), file_name); return 1; } |