]> granicus.if.org Git - sudo/commitdiff
Set def_preserve_groups before searching for the command when the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 13 Aug 2011 17:48:45 +0000 (13:48 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 13 Aug 2011 17:48:45 +0000 (13:48 -0400)
-P flag is specified.

--HG--
branch : 1.7

sudo.c

diff --git a/sudo.c b/sudo.c
index 924f21298f1dacc3fb6075e5cbd29a55a52842bf..25b7aa5049f143b7fdf75d374bfe599538437372 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -338,6 +338,10 @@ main(argc, argv, envp)
            def_closefrom = user_closefrom;
     }
 
+    /* If given the -P option, set the "preserve_groups" flag. */
+    if (ISSET(sudo_mode, MODE_PRESERVE_GROUPS))
+       def_preserve_groups = TRUE;
+
     cmnd_status = set_cmnd(sudo_mode);
 
 #ifdef HAVE_SETLOCALE
@@ -391,10 +395,6 @@ main(argc, argv, envp)
        pw_delref(pw);
     }
 
-    /* If given the -P option, set the "preserve_groups" flag. */
-    if (ISSET(sudo_mode, MODE_PRESERVE_GROUPS))
-       def_preserve_groups = TRUE;
-
     /* If no command line args and "set_home" is not set, error out. */
     if (ISSET(sudo_mode, MODE_IMPLIED_SHELL) && !def_shell_noargs)
        usage(1);