diff options
author | Ian Lance Taylor <iant@google.com> | 2007-10-14 06:49:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-10-14 06:49:14 +0000 |
commit | 75f2446ec3c13eca3fe0c7cfdbb232e760d36596 (patch) | |
tree | a243e4c2c79cd8790a316a38b552507b62bf0421 /gold/dirsearch.cc | |
parent | Fix typo in comment. (diff) | |
download | binutils-gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.tar.gz binutils-gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.tar.bz2 binutils-gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.zip |
Run all error handling through an Errors object. Delete output file
on error.
Diffstat (limited to 'gold/dirsearch.cc')
-rw-r--r-- | gold/dirsearch.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gold/dirsearch.cc b/gold/dirsearch.cc index 6dea53db714..45caf86daf2 100644 --- a/gold/dirsearch.cc +++ b/gold/dirsearch.cc @@ -23,6 +23,7 @@ #include "gold.h" #include <cerrno> +#include <cstring> #include <sys/types.h> #include <dirent.h> @@ -63,13 +64,10 @@ Dir_cache::read_files() if (d == NULL) { // We ignore directories which do not exist. - if (errno == ENOENT) - return; - - char *s = NULL; - if (asprintf(&s, _("can not read directory %s"), this->dirname_) < 0) - gold::gold_nomem(); - gold::gold_fatal(s, true); + if (errno != ENOENT) + gold::gold_error(_("%s: can not read directory: %s"), + this->dirname_, strerror(errno)); + return; } dirent* de; @@ -77,7 +75,8 @@ Dir_cache::read_files() this->files_.insert(std::string(de->d_name)); if (closedir(d) != 0) - gold::gold_fatal("closedir failed", true); + gold::gold_warning("%s: closedir failed: %s", this->dirname_, + strerror(errno)); } bool |