2020-04-01 14:34:51 +02:00
|
|
|
--- a/dictd.c
|
|
|
|
+++ b/dictd.c
|
|
|
|
@@ -332,6 +332,7 @@ static void xsigprocmask (int how, const
|
2018-10-16 07:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
static void block_signals (void)
|
|
|
|
{
|
|
|
|
sigset_t set;
|
2020-04-01 14:34:51 +02:00
|
|
|
@@ -353,6 +354,7 @@ static void unblock_signals (void)
|
2018-10-16 07:12:41 +02:00
|
|
|
|
|
|
|
xsigprocmask (SIG_UNBLOCK, &set, NULL);
|
|
|
|
}
|
|
|
|
+*/
|
|
|
|
|
|
|
|
static void handler( int sig )
|
|
|
|
{
|
2020-04-01 14:34:51 +02:00
|
|
|
@@ -1266,21 +1268,22 @@ static void release_root_privileges( voi
|
2018-10-16 07:12:41 +02:00
|
|
|
* -- Bob Hilliard
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
+ int unused __attribute__((unused));
|
|
|
|
if (geteuid() == 0) {
|
|
|
|
struct passwd *pwd;
|
|
|
|
|
|
|
|
if ((pwd = getpwnam("dictd"))) {
|
|
|
|
- setgid(pwd->pw_gid);
|
|
|
|
+ unused = setgid(pwd->pw_gid);
|
|
|
|
initgroups("dictd",pwd->pw_gid);
|
|
|
|
- setuid(pwd->pw_uid);
|
|
|
|
+ unused = setuid(pwd->pw_uid);
|
|
|
|
} else if ((pwd = getpwnam("nobody"))) {
|
|
|
|
- setgid(pwd->pw_gid);
|
|
|
|
+ unused = setgid(pwd->pw_gid);
|
|
|
|
initgroups("nobody",pwd->pw_gid);
|
|
|
|
- setuid(pwd->pw_uid);
|
|
|
|
+ unused = setuid(pwd->pw_uid);
|
|
|
|
} else {
|
|
|
|
- setgid(GID_NOGROUP);
|
|
|
|
+ unused = setgid(GID_NOGROUP);
|
|
|
|
initgroups("nobody", GID_NOGROUP);
|
|
|
|
- setuid(UID_NOBODY);
|
|
|
|
+ unused = setuid(UID_NOBODY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1464,6 +1467,7 @@ static void pid_file_write ()
|
|
|
|
static void reopen_012 (void)
|
|
|
|
{
|
|
|
|
int fd = open ("/dev/null", O_RDWR);
|
|
|
|
+ int unused __attribute__((unused));
|
|
|
|
if (fd == -1)
|
|
|
|
err_fatal_errno (__func__, ":E: can't open /dev/null");
|
|
|
|
|
|
|
|
@@ -1471,9 +1475,9 @@ static void reopen_012 (void)
|
|
|
|
close (1);
|
|
|
|
close (2);
|
|
|
|
|
|
|
|
- dup (fd);
|
|
|
|
- dup (fd);
|
|
|
|
- dup (fd);
|
|
|
|
+ unused = dup (fd);
|
|
|
|
+ unused = dup (fd);
|
|
|
|
+ unused = dup (fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main (int argc, char **argv, char **envp)
|
|
|
|
@@ -1489,6 +1493,7 @@ int main (int argc, char **argv, char **
|
|
|
|
int i;
|
|
|
|
|
|
|
|
int errno_accept = 0;
|
|
|
|
+ int unused __attribute__((unused));
|
|
|
|
|
|
|
|
const char * default_strategy_arg = "???";
|
|
|
|
|
2020-04-01 14:34:51 +02:00
|
|
|
@@ -1707,7 +1712,7 @@ int main (int argc, char **argv, char **
|
2018-10-16 07:12:41 +02:00
|
|
|
|
|
|
|
if (detach){
|
|
|
|
/* become a daemon */
|
|
|
|
- daemon (0, 1);
|
|
|
|
+ unused = daemon (0, 1);
|
|
|
|
reopen_012 ();
|
|
|
|
|
|
|
|
/* after fork from daemon(3) */
|