tpws: fix possible address unavailable error after reboot

This commit is contained in:
bol-van
2021-03-05 21:02:34 +03:00
parent 4a54b217e2
commit 00ca862068
6 changed files with 112 additions and 44 deletions

View File

@@ -88,24 +88,24 @@ bool droproot(uid_t uid, gid_t gid)
#ifdef __linux__
if (prctl(PR_SET_KEEPCAPS, 1L))
{
perror("prctl(PR_SET_KEEPCAPS): ");
perror("prctl(PR_SET_KEEPCAPS)");
return false;
}
#endif
// drop all SGIDs
if (setgroups(0,NULL))
{
perror("setgroups: ");
perror("setgroups");
return false;
}
if (setgid(gid))
{
perror("setgid: ");
perror("setgid");
return false;
}
if (setuid(uid))
{
perror("setuid: ");
perror("setuid");
return false;
}
#ifdef __linux__
@@ -138,7 +138,7 @@ void daemonize()
pid = fork();
if (pid == -1)
{
perror("fork: ");
perror("fork");
exit(2);
}
else if (pid != 0)