chiark / gitweb /
util: define union dirent_storage and make use of it everywhere
[elogind.git] / src / journal / sd-journal.c
index 2fa81727e049702bb0d5fae78decf37bded12275..acde84fe2d3138242b08ed1586df7ba1d9af3d5b 100644 (file)
@@ -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;