From: Todd C. Miller Date: Wed, 4 May 2016 20:14:38 +0000 (-0600) Subject: pid_t is defined by POSIX as a signed integer type so we don't need X-Git-Tag: SUDO_1_8_17^2~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=829917f0089bdd0e9c9ae006f197731879aceb2b;p=sudo pid_t is defined by POSIX as a signed integer type so we don't need a cast when comparing to -1. --- diff --git a/src/exec.c b/src/exec.c index f38128606..31c3bd5ce 100644 --- a/src/exec.c +++ b/src/exec.c @@ -560,7 +560,7 @@ dispatch_signal(struct sudo_event_base *evbase, pid_t child, * with SIGTTOU while the command continues to run. */ sigaction_t sa, osa; - pid_t saved_pgrp = (pid_t)-1; + pid_t saved_pgrp = -1; int signo = WSTOPSIG(status); int fd = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0); if (fd != -1) { @@ -895,7 +895,7 @@ handler(int s, siginfo_t *info, void *context) */ if (s != SIGCHLD && USER_SIGNALED(info) && info->si_pid != 0) { pid_t si_pgrp = getpgid(info->si_pid); - if (si_pgrp != (pid_t)-1) { + if (si_pgrp != -1) { if (si_pgrp == ppgrp || si_pgrp == cmnd_pid) return; } else if (info->si_pid == cmnd_pid) { @@ -952,7 +952,7 @@ handler_user_only(int s, siginfo_t *info, void *context) return; if (info->si_pid != 0) { pid_t si_pgrp = getpgid(info->si_pid); - if (si_pgrp != (pid_t)-1) { + if (si_pgrp != -1) { if (si_pgrp == ppgrp || si_pgrp == cmnd_pid) return; } else if (info->si_pid == cmnd_pid) { diff --git a/src/exec_pty.c b/src/exec_pty.c index 6ae587177..80800737e 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -137,7 +137,7 @@ mon_handler(int s, siginfo_t *info, void *context) */ if (s != SIGCHLD && USER_SIGNALED(info) && info->si_pid != 0) { pid_t si_pgrp = getpgid(info->si_pid); - if (si_pgrp != (pid_t)-1) { + if (si_pgrp != -1) { if (si_pgrp == cmnd_pgrp) return; } else if (info->si_pid == cmnd_pid) { diff --git a/src/sudo.c b/src/sudo.c index dedafd569..a53bb797c 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -505,7 +505,7 @@ get_user_info(struct user_details *ud) ud->pid = getpid(); ud->ppid = getppid(); ud->pgid = getpgid(0); - ud->tcpgid = (pid_t)-1; + ud->tcpgid = -1; fd = open(_PATH_TTY, O_RDWR|O_NOCTTY|O_NONBLOCK, 0); if (fd != -1) { ud->tcpgid = tcgetpgrp(fd);