forked from pool/dictd
87 lines
2.3 KiB
Diff
87 lines
2.3 KiB
Diff
|
diff -purN dictd-1.12.1/dictd.c dictd-1.12.1_new/dictd.c
|
||
|
--- dictd-1.12.1/dictd.c 2011-01-09 17:53:27.000000000 +0100
|
||
|
+++ dictd-1.12.1_new/dictd.c 2014-02-25 16:12:49.752301674 +0100
|
||
|
@@ -329,6 +329,7 @@ static void xsigprocmask (int how, const
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+/*
|
||
|
static void block_signals (void)
|
||
|
{
|
||
|
sigset_t set;
|
||
|
@@ -350,6 +351,7 @@ static void unblock_signals (void)
|
||
|
|
||
|
xsigprocmask (SIG_UNBLOCK, &set, NULL);
|
||
|
}
|
||
|
+*/
|
||
|
|
||
|
static void handler( int sig )
|
||
|
{
|
||
|
@@ -1264,21 +1266,22 @@ static void release_root_privileges( voi
|
||
|
* -- 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 = "???";
|
||
|
|
||
|
@@ -1696,7 +1701,7 @@ int main (int argc, char **argv, char **
|
||
|
|
||
|
if (detach){
|
||
|
/* become a daemon */
|
||
|
- daemon (0, 1);
|
||
|
+ unused = daemon (0, 1);
|
||
|
reopen_012 ();
|
||
|
|
||
|
/* after fork from daemon(3) */
|