summaryrefslogtreecommitdiff
path: root/gold/dirsearch.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 06:49:14 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 06:49:14 +0000
commit75f2446ec3c13eca3fe0c7cfdbb232e760d36596 (patch)
treea243e4c2c79cd8790a316a38b552507b62bf0421 /gold/dirsearch.cc
parenteb4dfdd470e49ab56eed5cead19704e0926530d0 (diff)
downloadbinutils-gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.tar.gz
Run all error handling through an Errors object. Delete output file
on error.
Diffstat (limited to 'gold/dirsearch.cc')
-rw-r--r--gold/dirsearch.cc15
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