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 3f8b95d..a3bacda 100644 (file)
@@ -135,11 +135,11 @@ static uint64_t available_space(Server *s, bool verbose) {
         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;