diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-06 01:40:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-06 14:21:10 +0100 |
commit | d1bddcec98551ea748f39a742a4cbcf9ea9254ef (patch) | |
tree | 69d708fc21347ec3316a39acd27d793fc0a67305 /src/shared/util.c | |
parent | 592fd144ae313855f48d0ca52a103013b41e5d59 (diff) |
condition: unify condition logic in one file
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index d33f349d81..39ce46adb4 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -6987,14 +6987,14 @@ int is_symlink(const char *path) { int is_dir(const char* path, bool follow) { struct stat st; + int r; - if (follow) { - if (stat(path, &st) < 0) - return -errno; - } else { - if (lstat(path, &st) < 0) - return -errno; - } + if (follow) + r = stat(path, &st); + else + r = lstat(path, &st); + if (r < 0) + return -errno; return !!S_ISDIR(st.st_mode); } |