summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/journal/sd-journal.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index bb116df047..283d593063 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1442,10 +1442,16 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
for (;;) {
struct dirent *de;
- union dirent_storage buf;
- r = readdir_r(d, &buf.de, &de);
- if (r != 0 || !de)
+ errno = 0;
+ de = readdir(d);
+ if (!de && errno != 0) {
+ r = -errno;
+ log_debug("Failed to read directory %s: %s",
+ m->path, strerror(errno));
+ return r;
+ }
+ if (!de)
break;
if (dirent_is_file_with_suffix(de, ".journal") ||
@@ -1526,11 +1532,17 @@ static int add_root_directory(sd_journal *j, const char *p) {
for (;;) {
struct dirent *de;
- union dirent_storage buf;
sd_id128_t id;
- r = readdir_r(d, &buf.de, &de);
- if (r != 0 || !de)
+ errno = 0;
+ de = readdir(d);
+ if (!de && errno != 0) {
+ r = -errno;
+ log_debug("Failed to read directory %s: %s",
+ m->path, strerror(errno));
+ return r;
+ }
+ if (!de)
break;
if (dirent_is_file_with_suffix(de, ".journal") ||