mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Guard lower close_range call with fd > 3 in os_exec_script
This commit is contained in:
parent
6491de0eaa
commit
2b71f5727e
1 changed files with 4 additions and 3 deletions
|
|
@ -839,7 +839,8 @@ int os_script(char** argv, char** envp, const char* run_as_user)
|
|||
*
|
||||
* For scripts we cannot set fd as CLOEXEC.
|
||||
*/
|
||||
close_range(3, fd - 1, CLOSE_RANGE_CLOEXEC);
|
||||
if (fd > 3)
|
||||
close_range(3, fd - 1, CLOSE_RANGE_CLOEXEC);
|
||||
close_range(fd + 1, ~0U, CLOSE_RANGE_CLOEXEC);
|
||||
#endif
|
||||
|
||||
|
|
@ -1333,7 +1334,7 @@ int os_wait(pid_t pid, int* status)
|
|||
} while (ret == -1 && errno == EINTR);
|
||||
|
||||
if (ret == -1) {
|
||||
os_syslog(OS_LVL_INFO, "failed to wait, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to wait, errno=%s(%d)", strerror(errno), errno);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -1502,7 +1503,7 @@ void os_privileges_acquire(void)
|
|||
/* If EPERM, process lacks permission to switch privileges (e.g. dropped capabilities); continue with active privileges */
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue