summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-19 22:21:09 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-19 22:21:09 +0200
commit7d5e9c0f60cddf01ec803012cbdc02d2f55b78c1 (patch)
treeecb5dc336ce9e0ecf6d5e3b6757b0a10f7f1e692 /src/journal/sd-journal.c
parent57f3067825d9361d7487f272bfaff3b36c684c62 (diff)
util: define union dirent_storage and make use of it everywhere
Make sure to allocate enough space for readdir_r(). https://bugzilla.redhat.com/show_bug.cgi?id=858754
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 2fa81727e0..acde84fe2d 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1256,9 +1256,10 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
}
for (;;) {
- struct dirent buf, *de;
+ struct dirent *de;
+ union dirent_storage buf;
- r = readdir_r(d, &buf, &de);
+ r = readdir_r(d, &buf.de, &de);
if (r != 0 || !de)
break;
@@ -1334,10 +1335,11 @@ static int add_root_directory(sd_journal *j, const char *p) {
}
for (;;) {
- struct dirent buf, *de;
+ struct dirent *de;
+ union dirent_storage buf;
sd_id128_t id;
- r = readdir_r(d, &buf, &de);
+ r = readdir_r(d, &buf.de, &de);
if (r != 0 || !de)
break;