summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRadek Podgorny <radek@podgorny.cz>2014-02-22 17:33:49 +0100
committerRadek Podgorny <radek@podgorny.cz>2014-02-22 17:33:49 +0100
commitd3c53337dbe63ac2c4a3580d624ee030a804691b (patch)
treec664e84cd70f6d5bba4288f4d074babe6d25f35b /src
parentdcc50a0c2b73ebbc3c038c52ca731c25054d3622 (diff)
downloadunionfs-fuse-d3c53337dbe63ac2c4a3580d624ee030a804691b.tar.gz
statfs: Fix clang static analyzer error
If statvfs_local() or stat() returned errors devno[i] was not set, but later on used. We don't need to continue at all, but we can simply return an error at this point. (from bernd's tree)
Diffstat (limited to 'src')
-rw-r--r--src/unionfs.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/unionfs.c b/src/unionfs.c
index a487d8c..41f4c52 100644
--- a/src/unionfs.c
+++ b/src/unionfs.c
@@ -573,15 +573,23 @@ static int unionfs_statfs(const char *path, struct statvfs *stbuf) {
dev_t devno[uopt.nbranches];
+ int retVal = 0;
+
int i = 0;
for (i = 0; i < uopt.nbranches; i++) {
struct statvfs stb;
int res = statvfs_local(uopt.branches[i].path, &stb);
- if (res == -1) continue;
+ if (res == -1) {
+ retVal = -errno;
+ break;
+ }
struct stat st;
res = stat(uopt.branches[i].path, &st);
- if (res == -1) continue;
+ if (res == -1) {
+ retVal = -errno;
+ break;
+ }
devno[i] = st.st_dev;
if (first) {
@@ -624,7 +632,7 @@ static int unionfs_statfs(const char *path, struct statvfs *stbuf) {
}
}
- RETURN(0);
+ RETURN(retVal);
}
static int unionfs_symlink(const char *from, const char *to) {