mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-03 01:46:02 -05:00
Regain root privileges to unlink PID file at exit
This commit is contained in:
parent
1ac46983b9
commit
207e85c6c0
10
src/main.c
10
src/main.c
@ -599,9 +599,15 @@ main(int argc, char **argv)
|
|||||||
daemon_fail:
|
daemon_fail:
|
||||||
if (background)
|
if (background)
|
||||||
{
|
{
|
||||||
ret = unlink(pidfile);
|
ret = seteuid(0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
DPRINTF(E_WARN, L_MAIN, "Could not unlink PID file %s: %s\n", pidfile, strerror(errno));
|
DPRINTF(E_LOG, L_MAIN, "seteuid() failed: %s\n", strerror(errno));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = unlink(pidfile);
|
||||||
|
if (ret < 0)
|
||||||
|
DPRINTF(E_LOG, L_MAIN, "Could not unlink PID file %s: %s\n", pidfile, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_block_fail:
|
signal_block_fail:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user