]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- check return value 115/head
authorArvin Schnell <aschnell@suse.de>
Wed, 24 Sep 2014 13:32:52 +0000 (15:32 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 24 Sep 2014 13:32:52 +0000 (15:32 +0200)
package/snapper.changes
snapper/FileUtils.cc

index 6df512fed0ce75be40821adac65c940ec795968d..ea65e7fcf4b00bdacedbf4fdb8aab4059f4c4e38 100644 (file)
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Wed Sep 24 15:29:51 CEST 2014 - aschnell@suse.de
+
+- resolved some code issues found by code analysis
+
 -------------------------------------------------------------------
 Wed Aug 27 17:55:32 CEST 2014 - dsterba@suse.cz
 
index bd5cf1d7f0ec87232e81a895941ddfa9e0907fad..c92b3f9a09538fea2aae6bce136eed30b420cd37 100644 (file)
@@ -61,7 +61,12 @@ namespace snapper
        }
 
        struct stat buf;
-       fstat(dirfd, &buf);
+       if (fstat(dirfd, &buf) != 0)
+       {
+           y2err("fstat failed path:" << base_path << " error:" << stringerror(errno));
+           throw IOErrorException();
+       }
+
        if (!S_ISDIR(buf.st_mode))
        {
            y2err("not a directory path:" << base_path);
@@ -86,7 +91,12 @@ namespace snapper
        }
 
        struct stat buf;
-       fstat(dirfd, &buf);
+       if (fstat(dirfd, &buf) != 0)
+       {
+           y2err("fstat failed path:" << base_path << " error:" << stringerror(errno));
+           throw IOErrorException();
+       }
+
        if (!S_ISDIR(buf.st_mode))
        {
            y2err("not a directory path:" << dir.fullname(name));