summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-06 01:40:37 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-06 14:21:10 +0100
commitd1bddcec98551ea748f39a742a4cbcf9ea9254ef (patch)
tree69d708fc21347ec3316a39acd27d793fc0a67305 /src/shared/util.c
parent592fd144ae313855f48d0ca52a103013b41e5d59 (diff)
condition: unify condition logic in one file
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c14
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);
}