mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Add fallback to PERM_IOLOG when making the final componenet of iolog_dir.
This commit is contained in:
@@ -125,9 +125,15 @@ io_mkdirs(char *path)
|
|||||||
/* Create final path component. */
|
/* Create final path component. */
|
||||||
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
|
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
|
||||||
"mkdir %s, mode 0%o", path, (unsigned int) iolog_dirmode);
|
"mkdir %s, mode 0%o", path, (unsigned int) iolog_dirmode);
|
||||||
if (mkdir(path, iolog_dirmode) != 0 && errno != EEXIST) {
|
ok = mkdir(path, iolog_dirmode) == 0 || errno == EEXIST;
|
||||||
sudo_warn(U_("unable to mkdir %s"), path);
|
if (!ok) {
|
||||||
ok = false;
|
if (!uid_changed) {
|
||||||
|
/* Try again as the I/O log owner (for NFS). */
|
||||||
|
uid_changed = set_perms(PERM_IOLOG);
|
||||||
|
ok = mkdir(path, iolog_dirmode) == 0 || errno == EEXIST;
|
||||||
|
}
|
||||||
|
if (!ok)
|
||||||
|
sudo_warn(U_("unable to mkdir %s"), path);
|
||||||
} else {
|
} else {
|
||||||
ignore_result(chown(path, iolog_uid, iolog_gid));
|
ignore_result(chown(path, iolog_uid, iolog_gid));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user