chiark / gitweb /
journald/server: replace readdir_r with readdir
authorFlorian Weimer <fweimer@redhat.com>
Thu, 19 Dec 2013 11:23:12 +0000 (12:23 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 21 Dec 2013 23:35:55 +0000 (18:35 -0500)
The available_space function now returns 0 if reading the directory
fails.  Previously, such errors were silently ignored.

src/journal/journald-server.c

index 3f8b95dee0f501fbf2c1c58e2727a8eed2517a22..a3bacdab66a68ec930d6903f9ec0166872d79664 100644 (file)
@@ -135,11 +135,11 @@ static uint64_t available_space(Server *s, bool verbose) {
         for (;;) {
                 struct stat st;
                 struct dirent *de;
         for (;;) {
                 struct stat st;
                 struct dirent *de;
-                union dirent_storage buf;
 
 
-                r = readdir_r(d, &buf.de, &de);
-                if (r != 0)
-                        break;
+                errno = 0;
+                de = readdir(d);
+                if (!de && errno != 0)
+                        return 0;
 
                 if (!de)
                         break;
 
                 if (!de)
                         break;