From: Arvin Schnell Date: Wed, 24 Sep 2014 13:32:52 +0000 (+0200) Subject: - check return value X-Git-Tag: v0.2.5~12^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F115%2Fhead;p=thirdparty%2Fsnapper.git - check return value --- diff --git a/package/snapper.changes b/package/snapper.changes index 6df512fe..ea65e7fc 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -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 diff --git a/snapper/FileUtils.cc b/snapper/FileUtils.cc index bd5cf1d7..c92b3f9a 100644 --- a/snapper/FileUtils.cc +++ b/snapper/FileUtils.cc @@ -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));