]> granicus.if.org Git - sudo/commitdiff
Use WIFEXITED and WEXITSTATUS macros. If there are systems out there
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 22 Jan 2004 02:44:13 +0000 (02:44 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 22 Jan 2004 02:44:13 +0000 (02:44 +0000)
that want to run sudo that still don't support these we can try to
deal with that later.

visudo.c

index cf3dfdba6072fec9536f4d251114025f90024499..0c657d4be681a4c4f009af4ad441a90ae389feea 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -638,8 +638,9 @@ run_command(path, argv)
 
     (void) sigprocmask(SIG_SETMASK, &oset, NULL);
 
-    /* XXX - should use WEXITSTATUS() */
-    return(pid == -1 ? -1 : (status >> 8));
+    if (pid == -1 || !WIFEXITED(status))
+       return(-1);
+    return(WEXITSTATUS(status));
 }
 
 static int