summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);
}