]> granicus.if.org Git - sudo/commitdiff
pid_t is defined by POSIX as a signed integer type so we don't need
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 4 May 2016 20:14:38 +0000 (14:14 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 4 May 2016 20:14:38 +0000 (14:14 -0600)
a cast when comparing to -1.

src/exec.c
src/exec_pty.c
src/sudo.c

index f38128606686cd6c2e3883e94303fc33a7b6b754..31c3bd5ce1a06ac9eaa66111f8bb909325bc5d26 100644 (file)
@@ -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) {
index 6ae58717784d5c0685e67fff8b064dc8c55bbbdd..80800737eae4ee6b2fb590ba3595bf563f91da73 100644 (file)
@@ -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) {
index dedafd5698d7993a8292878c8f529fbf0b145b0f..a53bb797c692e6ba5b846e730861576b6fd3bce0 100644 (file)
@@ -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);