diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2025-11-01 16:24:18 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2025-11-01 16:24:18 +0100 |
| commit | 389a20be460e24340b1cf5a6e170e138915d71c2 (patch) | |
| tree | d09c78fd6e9861608c99604011e3113c83538f8e /FICS | |
| parent | 4e04743839b68858e47aacb5f037fec4b67eb036 (diff) | |
prep_dir_for_privdrop: chown() and chmod() 'path'
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/prep_dir_for_privdrop.cpp | 4 |
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()); |
