summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
authorGravatar default2023-07-09 20:23:38 +0200
committerGravatar default2023-07-09 20:23:38 +0200
commitd2aa5727baf8b17f99d0ffc041b225463bd2684d (patch)
tree2c2a48478f7b1ae5c66ea6d46bb4c6d9254ca7d7 /snac.c
parentBumper version. (diff)
downloadsnac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.tar.gz
snac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.tar.xz
snac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.zip
Fixed failed mkdir() in restricted environments.
Diffstat (limited to '')
-rw-r--r--snac.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/snac.c b/snac.c
index 7fbb61e..b35e645 100644
--- a/snac.c
+++ b/snac.c
@@ -35,8 +35,13 @@ int mkdirx(const char *pathname)
35{ 35{
36 int ret; 36 int ret;
37 37
38 if ((ret = mkdir(pathname, DIR_PERM)) != -1) 38 if ((ret = mkdir(pathname, DIR_PERM)) != -1) {
39 ret = chmod(pathname, DIR_PERM); 39 /* try to the set the setgid bit, to allow system users
40 to create files in these directories using the
41 command-line tool. This may fail in some restricted
42 environments, but it's of no use there anyway */
43 chmod(pathname, DIR_PERM_ADD);
44 }
40 45
41 return ret; 46 return ret;
42} 47}