aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/prep_dir_for_privdrop.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/FICS/prep_dir_for_privdrop.cpp b/FICS/prep_dir_for_privdrop.cpp
index 4b1d66b..7d65973 100644
--- a/FICS/prep_dir_for_privdrop.cpp
+++ b/FICS/prep_dir_for_privdrop.cpp
@@ -124,6 +124,10 @@ prep_dir_for_privdrop(const char *path)
if (get_uid_and_gid(uid, gid) == -1)
throw std::runtime_error("failed to get uid/gid");
+ else if (chown(path, uid, gid) != 0)
+ throw std::runtime_error("chown() error");
+ else if (chmod(path, dir_mode) != 0)
+ throw std::runtime_error("chmod() error");
for (auto const &dir_ent : dir_it) {
const std::string str(dir_ent.path().string());