The daemon code currently tries to nice(-1) just after having given up root
privileges, which fails. This patch moves the nice(-1) call to just before
the code that gives up the required privileges.
Signed-off-by: Chris Boot <bootc@bootc.net>
warn_and_exit(daemonize);
}
+ errno = 0;
+ if (nice(-1) == -1) {
+ if (errno != 0)
+ ulogd_log(ULOGD_ERROR, "Could not nice process: %s\n",
+ strerror(errno));
+ }
+
if (change_uid) {
ulogd_log(ULOGD_NOTICE, "Changing UID / GID\n");
if (setgid(gid)) {
}
}
- errno = 0;
- if (nice(-1) == -1) {
- if (errno != 0)
- ulogd_log(ULOGD_ERROR, "Could not nice process: %s\n",
- strerror(errno));
- }
-
if (daemonize){
if (fork()) {