]> granicus.if.org Git - shadow/commitdiff
* src/su.c: fork() and waitpid() return a pid_t, not an int.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 21:02:07 +0000 (21:02 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 13 Jun 2008 21:02:07 +0000 (21:02 +0000)
* src/su.c: Add brackets and parenthesis.
* src/su.c: Ignore the return value of signal().

ChangeLog
src/su.c

index 727f74104eccad0fcf6f075549bfea9a99f310d5..6f4b3ed17121f17f18fc6d2da09505b789a756bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-13  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/su.c: fork() and waitpid() return a pid_t, not an int.
+       * src/su.c: Add brackets and parenthesis.
+       * src/su.c: Ignore the return value of signal().
+
 2008-06-13  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupdel.c: The ID argument of audit_logger is an unsigned
index 155f1e75985d85b457b8caa1a487ac8ffbd7dcc3..9e011d9674bf947867b352a35dd09d1a6f8e5b5e 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -183,7 +183,7 @@ static void catch_signals (unused int sig)
 static void run_shell (const char *shellstr, char *args[], bool doshell,
                       char *const envp[])
 {
-       int child;
+       pid_t child;
        sigset_t ourset;
        int status;
        int ret;
@@ -197,12 +197,13 @@ static void run_shell (const char *shellstr, char *args[], bool doshell,
                pam_end (pamh, PAM_SUCCESS | PAM_DATA_SILENT);
                 */
 
-               if (doshell)
+               if (doshell) {
                        (void) shell (shellstr, (char *) args[0], envp);
-               else
+               } else {
                        (void) execve (shellstr, (char **) args, envp);
+               }
                exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
-       } else if (child == -1) {
+       } else if ((pid_t)-1 == child) {
                (void) fprintf (stderr, "%s: Cannot fork user shell\n", Prog);
                SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
                closelog ();
@@ -235,11 +236,11 @@ static void run_shell (const char *shellstr, char *args[], bool doshell,
 
        if (!caught) {
                do {
-                       int pid;
+                       pid_t pid;
 
                        pid = waitpid (-1, &status, WUNTRACED);
 
-                       if ((-1 != pid) && (0 != WIFSTOPPED (status))) {
+                       if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
                                /* The child (shell) was suspended.
                                 * Suspend su. */
                                kill (getpid (), WSTOPSIG(status));
@@ -663,8 +664,8 @@ int main (int argc, char **argv)
                shellstr = "/bin/sh";
        }
 
-       signal (SIGINT, SIG_IGN);
-       signal (SIGQUIT, SIG_IGN);
+       (void) signal (SIGINT, SIG_IGN);
+       (void) signal (SIGQUIT, SIG_IGN);
 #ifdef USE_PAM
        ret = pam_authenticate (pamh, 0);
        if (PAM_SUCCESS != ret) {
@@ -704,7 +705,7 @@ int main (int argc, char **argv)
         * Set up a signal handler in case the user types QUIT.
         */
        die (0);
-       oldsig = signal (SIGQUIT, die);
+       (void) oldsig = signal (SIGQUIT, die);
 
        /*
         * See if the system defined authentication method is being used. 
@@ -716,7 +717,7 @@ int main (int argc, char **argv)
                         "Authentication failed for %s", name));
                su_failure (tty);
        }
-       signal (SIGQUIT, oldsig);
+       (void) signal (SIGQUIT, oldsig);
 
        /*
         * Check to see if the account is expired. root gets to ignore any
@@ -756,8 +757,8 @@ int main (int argc, char **argv)
        }
 #endif                         /* !USE_PAM */
 
-       signal (SIGINT, SIG_DFL);
-       signal (SIGQUIT, SIG_DFL);
+       (void) signal (SIGINT, SIG_DFL);
+       (void) signal (SIGQUIT, SIG_DFL);
 
        cp = getdef_str ((pwent.pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
        if (NULL == cp) {