[systemd-commits] 2 commits - src/util.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Wed Jan 5 07:18:01 PST 2011


 TODO       |    3 ---
 src/util.c |   13 ++++++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 06ac173943858b37980bee645329d4bb18dea47c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 5 16:17:55 2011 +0100

    update TODO

diff --git a/TODO b/TODO
index 5bca513..fb23de9 100644
--- a/TODO
+++ b/TODO
@@ -16,9 +16,6 @@
 * load EnvironmentFile= when starting services, not when reloading configuration
   https://bugzilla.redhat.com/show_bug.cgi?id=661282
 
-* nicer warning messages if two files include the same file names in /etc/tmpfiles.d
-  https://bugzilla.redhat.com/show_bug.cgi?id=662490
-
 * somehow some /etc/fstab supplied mount params are never applied to api fs
   https://bugzilla.redhat.com/show_bug.cgi?id=663108
 

commit c4731d1135d54609e33df1569fefbb0c96824896
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 5 16:17:26 2011 +0100

    util: don't pass invalid fd to fdopendir() on error to avoid corruption of errno

diff --git a/src/util.c b/src/util.c
index 21afdce..aa1f19e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3436,7 +3436,18 @@ bool null_or_empty(struct stat *st) {
 }
 
 DIR *xopendirat(int fd, const char *name, int flags) {
-        return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags));
+        int nfd;
+        DIR *d;
+
+        if ((nfd = openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags)) < 0)
+                return NULL;
+
+        if (!(d = fdopendir(nfd))) {
+                close_nointr_nofail(nfd);
+                return NULL;
+        }
+
+        return d;
 }
 
 int signal_from_string_try_harder(const char *s) {



More information about the systemd-commits mailing list