summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-06 01:40:37 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-11-14 14:22:02 -0500
commitafd5b52fcf667b771d90223992ca0454afdde866 (patch)
tree94478a08d57e29ae6530ba08eaea82fa042b4e65 /src
parent9db4dfff9ebe1f5fd1c4aa8c64d6d42b62c2576e (diff)
condition: unify condition logic in one file
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-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 d58b9f4bed..6c368b61bb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1421,14 +1421,14 @@ char *tempfn_xxxxxx(const char *p) {
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);
}