diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-10-13 14:33:51 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-10-13 14:33:51 +0000 |
commit | fb5b547845302fe64f118f9bc5eb0ef636cfafb7 (patch) | |
tree | dade2ef6bd2186d3a9957430326143c3accaa25d /binutils/strings.c | |
parent | 2a1b9a480accc2f7049279646ba33cd887eb3abe (diff) | |
download | gdb-fb5b547845302fe64f118f9bc5eb0ef636cfafb7.zip gdb-fb5b547845302fe64f118f9bc5eb0ef636cfafb7.tar.gz gdb-fb5b547845302fe64f118f9bc5eb0ef636cfafb7.tar.bz2 |
* strings.c (statbuf): New typedef.
(file_stat): Define.
(strings_object_file): Avoid using get_file_size, instead do the
checks here, using file_stat.
* configure.in (HAVE_STAT64): New test.
* configure: Rebuilt.
* config.in: Rebuilt.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r-- | binutils/strings.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/binutils/strings.c b/binutils/strings.c index 8a27fa8..17dbc7c 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -104,6 +104,13 @@ typedef off64_t file_off; typedef off_t file_off; #define file_open(s,m) fopen(s, m) #endif +#ifdef HAVE_STAT64 +typedef struct stat64 statbuf; +#define file_stat(f,s) stat64(f, s) +#else +typedef struct stat statbuf; +#define file_stat(f,s) stat(f, s) +#endif /* Radix for printing addresses (must be 8, 10 or 16). */ static int address_radix; @@ -370,8 +377,17 @@ strings_object_file (const char *file) static bfd_boolean strings_file (char *file) { - if (get_file_size (file) < 1) - return FALSE; + statbuf st; + + if (file_stat (file, &st) < 0) + { + if (errno == ENOENT) + non_fatal (_("'%s': No such file"), file); + else + non_fatal (_("Warning: could not locate '%s'. reason: %s"), + file, strerror (errno)); + return FALSE; + } /* If we weren't told to scan the whole file, try to open it as an object file and only look at |