diff options
author | Bernd Schubert <bernd.schubert@itwm.fraunhofer.de> | 2012-05-20 23:29:39 +0200 |
---|---|---|
committer | Bernd Schubert <bernd.schubert@itwm.fraunhofer.de> | 2012-05-20 23:29:39 +0200 |
commit | 415291e590916b407b9e45e7eb0737163f4e58f0 (patch) | |
tree | b799359efee40429580c7619e1fec7f373646f06 | |
parent | a41c6ff888754416becd3df07b7fd4dd73c71c4c (diff) | |
download | unionfs-fuse-415291e590916b407b9e45e7eb0737163f4e58f0.tar.gz |
Fix RETURN() calls. The macros only takes integers.
Using complex expressions in RETURN() will lead to unexpected
results.
-rw-r--r-- | src/findbranch.c | 6 | ||||
-rw-r--r-- | src/general.c | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/findbranch.c b/src/findbranch.c index 8c8d703..6fe0eb9 100644 --- a/src/findbranch.c +++ b/src/findbranch.c @@ -102,7 +102,8 @@ static int find_branch(const char *path, searchflag_t flag) { */ int find_rorw_branch(const char *path) { DBG("%s\n", path); - RETURN(find_branch(path, RWRO)); + int res = find_branch(path, RWRO); + RETURN(res); } /** @@ -174,7 +175,8 @@ out: */ int find_rw_branch_cutlast(const char *path) { int rw_hint = -1; // autodetect rw_branch - RETURN(__find_rw_branch_cutlast(path, rw_hint)); + int res = __find_rw_branch_cutlast(path, rw_hint); + RETURN(res); } /** diff --git a/src/general.c b/src/general.c index fcec693..f73b2e2 100644 --- a/src/general.c +++ b/src/general.c @@ -46,7 +46,7 @@ static int filedir_hidden(const char *path) { struct stat stbuf; int res = lstat(p, &stbuf); - if (res == 0) RETURN(true); + if (res == 0) RETURN(1); RETURN(0); } @@ -156,6 +156,8 @@ static int do_create_whiteout(const char *path, int branch_rw, enum whiteout mod res = close(res); } else { res = mkdir(p, S_IRWXU); + if (res) + USYSLOG(LOG_ERR, "Creating %s failed: %s\n", p, strerror(errno)); } RETURN(res); @@ -166,7 +168,8 @@ static int do_create_whiteout(const char *path, int branch_rw, enum whiteout mod */ int hide_file(const char *path, int branch_rw) { DBG("%s\n", path); - RETURN(do_create_whiteout(path, branch_rw, WHITEOUT_FILE)); + int res = do_create_whiteout(path, branch_rw, WHITEOUT_FILE); + RETURN(res); } /** @@ -174,7 +177,8 @@ int hide_file(const char *path, int branch_rw) { */ int hide_dir(const char *path, int branch_rw) { DBG("%s\n", path); - RETURN(do_create_whiteout(path, branch_rw, WHITEOUT_DIR)); + int res = do_create_whiteout(path, branch_rw, WHITEOUT_DIR); + RETURN(res); } /** @@ -186,7 +190,8 @@ int maybe_whiteout(const char *path, int branch_rw, enum whiteout mode) { // we are not interested in the branch itself, only if it exists at all if (find_rorw_branch(path) != -1) { - RETURN(do_create_whiteout(path, branch_rw, mode)); + int res = do_create_whiteout(path, branch_rw, mode); + RETURN(res); } RETURN(0); |