diff options
| author | 2023-07-09 20:23:38 +0200 | |
|---|---|---|
| committer | 2023-07-09 20:23:38 +0200 | |
| commit | d2aa5727baf8b17f99d0ffc041b225463bd2684d (patch) | |
| tree | 2c2a48478f7b1ae5c66ea6d46bb4c6d9254ca7d7 /snac.c | |
| parent | Bumper version. (diff) | |
| download | penes-snac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.tar.gz penes-snac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.tar.xz penes-snac2-d2aa5727baf8b17f99d0ffc041b225463bd2684d.zip | |
Fixed failed mkdir() in restricted environments.
Diffstat (limited to 'snac.c')
| -rw-r--r-- | snac.c | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -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 | } |