Commit 7b166557 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

fileutils: check returns value of chmod calls

Fix coverity CID # 1352556 and 1369557

Change-Id: I6ca83b64a107dce734deb3c8355c87c2f56be606
Tuleap: #909
Reviewed-by: default avatarStepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
parent 953c3052
......@@ -91,7 +91,10 @@ bool check_dir(const char *path,
return false;
}
#ifndef _WIN32
chmod(path, dirmode);
if (chmod(path, dirmode) < 0) {
RING_ERR("fileutils::check_dir(): chmod() failed on '%s', %s", path, strerror(errno));
return false;
}
#endif
} else
closedir(dir);
......@@ -281,7 +284,8 @@ saveFile(const std::string& path,
}
file.write((char*)data.data(), data.size());
#ifndef _WIN32
chmod(path.c_str(), mode);
if (chmod(path.c_str(), mode) < 0)
RING_WARN("fileutils::saveFile(): chmod() failed on '%s', %s", path.c_str(), strerror(errno));
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment