[Pkg-shadow-commits] r2155 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Jun 13 21:02:07 UTC 2008


Author: nekral-guest
Date: 2008-06-13 21:02:07 +0000 (Fri, 13 Jun 2008)
New Revision: 2155

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/su.c
Log:
	* 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().


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-13 20:59:04 UTC (rev 2154)
+++ upstream/trunk/ChangeLog	2008-06-13 21:02:07 UTC (rev 2155)
@@ -1,5 +1,11 @@
 2008-06-13  Nicolas François  <nicolas.francois at 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 at centraliens.net>
+
 	* src/groupdel.c: The ID argument of audit_logger is an unsigned
 	int. Use AUDIT_NO_ID instead of -1.
 

Modified: upstream/trunk/src/su.c
===================================================================
--- upstream/trunk/src/su.c	2008-06-13 20:59:04 UTC (rev 2154)
+++ upstream/trunk/src/su.c	2008-06-13 21:02:07 UTC (rev 2155)
@@ -183,7 +183,7 @@
 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 @@
 		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 @@
 
 	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 @@
 		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 @@
 	 * 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 @@
 			 "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 @@
 	}
 #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) {




More information about the Pkg-shadow-commits mailing list