[systemd-devel] [PATCH 09/11] journald/server: replace readdir_r with readdir

Florian Weimer fweimer at redhat.com
Thu Dec 19 03:23:12 PST 2013


The available_space function now returns 0 if reading the directory
fails.  Previously, such errors were silently ignored.
---
 src/journal/journald-server.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 3f8b95d..a3bacda 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -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;
-- 
1.8.3.1



More information about the systemd-devel mailing list