mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-24 22:15:04 +00:00
Fixed failed mkdir() in restricted environments.
This commit is contained in:
parent
c562a4531c
commit
d2aa5727ba
2 changed files with 9 additions and 3 deletions
9
snac.c
9
snac.c
|
@ -35,8 +35,13 @@ int mkdirx(const char *pathname)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((ret = mkdir(pathname, DIR_PERM)) != -1)
|
if ((ret = mkdir(pathname, DIR_PERM)) != -1) {
|
||||||
ret = chmod(pathname, DIR_PERM);
|
/* try to the set the setgid bit, to allow system users
|
||||||
|
to create files in these directories using the
|
||||||
|
command-line tool. This may fail in some restricted
|
||||||
|
environments, but it's of no use there anyway */
|
||||||
|
chmod(pathname, DIR_PERM_ADD);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
3
snac.h
3
snac.h
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
#define WHAT_IS_SNAC_URL "https:/" "/comam.es/what-is-snac"
|
#define WHAT_IS_SNAC_URL "https:/" "/comam.es/what-is-snac"
|
||||||
|
|
||||||
#define DIR_PERM 02770
|
#define DIR_PERM 00770
|
||||||
|
#define DIR_PERM_ADD 02770
|
||||||
|
|
||||||
#define ISO_DATE_SPEC "%Y-%m-%dT%H:%M:%SZ"
|
#define ISO_DATE_SPEC "%Y-%m-%dT%H:%M:%SZ"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue