summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-03-23 18:54:31 +0700
committerLennart Poettering <lennart@poettering.net>2015-03-26 11:56:22 +0100
commit1532227a19f9ec56b4b32f0bfa6806c55d6ce14c (patch)
treefd3165c5f339a4810ab0ac999dbc4a37baeeb532
parent8dc1b304ee134c8b2ad56b9ebaf9ae3b38332f73 (diff)
tmpfiles: minor simplification
-rw-r--r--src/tmpfiles/tmpfiles.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 55a6a7bb54..c4c6d8e693 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -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;
}