chiark / gitweb /
tmpfiles: minor simplification
authorLennart Poettering <lennart@poettering.net>
Mon, 23 Mar 2015 11:54:31 +0000 (18:54 +0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 26 Mar 2015 10:56:22 +0000 (11:56 +0100)
src/tmpfiles/tmpfiles.c

index 55a6a7b..c4c6d8e 100644 (file)
@@ -174,7 +174,6 @@ static bool takes_ownership(ItemType t) {
                       CREATE_CHAR_DEVICE,
                       CREATE_BLOCK_DEVICE,
                       COPY_FILES,
-
                       WRITE_FILE,
                       IGNORE_PATH,
                       IGNORE_DIRECTORY_PATH,
@@ -314,16 +313,16 @@ static DIR* xopendirat_nomod(int dirfd, const char *path) {
         DIR *dir;
 
         dir = xopendirat(dirfd, path, O_NOFOLLOW|O_NOATIME);
-        if (!dir) {
-                log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m",
-                                dirfd == AT_FDCWD ? "" : "sub", path);
-                if (errno == EPERM) {
-                        dir = xopendirat(dirfd, path, O_NOFOLLOW);
-                        if (!dir)
-                                log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m",
-                                                dirfd == AT_FDCWD ? "" : "sub", path);
-                }
-        }
+        if (dir)
+                return dir;
+
+        log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m", dirfd == AT_FDCWD ? "" : "sub", path);
+        if (errno != EPERM)
+                return NULL;
+
+        dir = xopendirat(dirfd, path, O_NOFOLLOW);
+        if (!dir)
+                log_debug_errno(errno, "Cannot open %sdirectory \"%s\": %m", dirfd == AT_FDCWD ? "" : "sub", path);
 
         return dir;
 }