]> granicus.if.org Git - shadow/commitdiff
Merge pull request #103 from HarmtH/be-predictable
authorSerge Hallyn <serge@hallyn.com>
Fri, 30 Mar 2018 06:10:51 +0000 (23:10 -0700)
committerGitHub <noreply@github.com>
Fri, 30 Mar 2018 06:10:51 +0000 (23:10 -0700)
su.c: be more predictable

1  2 
src/su.c

diff --cc src/su.c
index 0e5dd6fd32006862cfcfb44a19f9c6aa7027b15f,8a5371f7cd7d246b1a44fd321e5742cd116a1344..685f7bb0d651601e05cecf1a88c9e229bb48f7c2
+++ b/src/su.c
@@@ -809,16 -810,17 +810,10 @@@ static void process_flags (int argc, ch
        if ((optind < argc) && (strcmp (argv[optind], "-") == 0)) {
                fakelogin = true;
                optind++;
 -              if (   (optind < argc)
 -                  && (strcmp (argv[optind], "--") == 0)) {
 -                      optind++;
 -              }
        }
  
-       /*
-        * The next argument must be either a user ID, or some flag to a
-        * subshell. Pretty sticky since you can't have an argument which
-        * doesn't start with a "-" unless you specify the new user name.
-        * Any remaining arguments will be passed to the user's login shell.
-        */
-       if ((optind < argc) && ('-' != argv[optind][0])) {
+       if (optind < argc) {
                STRFCPY (name, argv[optind++]); /* use this login id */
 -              if ((optind < argc) && (strcmp (argv[optind], "--") == 0)) {
 -                      optind++;
 -              }
        }
        if ('\0' == name[0]) {          /* use default user */
                struct passwd *root_pw = getpwnam ("root");