Merge pull request #102 from HarmtH/fix-dashdash-slurp
su.c: fix '--' slurping
This commit is contained in:
commit
a3d91ae318
7
src/su.c
7
src/su.c
@ -809,10 +809,6 @@ static void process_flags (int argc, char **argv)
|
|||||||
if ((optind < argc) && (strcmp (argv[optind], "-") == 0)) {
|
if ((optind < argc) && (strcmp (argv[optind], "-") == 0)) {
|
||||||
fakelogin = true;
|
fakelogin = true;
|
||||||
optind++;
|
optind++;
|
||||||
if ( (optind < argc)
|
|
||||||
&& (strcmp (argv[optind], "--") == 0)) {
|
|
||||||
optind++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -823,9 +819,6 @@ static void process_flags (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if ((optind < argc) && ('-' != argv[optind][0])) {
|
if ((optind < argc) && ('-' != argv[optind][0])) {
|
||||||
STRFCPY (name, argv[optind++]); /* use this login id */
|
STRFCPY (name, argv[optind++]); /* use this login id */
|
||||||
if ((optind < argc) && (strcmp (argv[optind], "--") == 0)) {
|
|
||||||
optind++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ('\0' == name[0]) { /* use default user */
|
if ('\0' == name[0]) { /* use default user */
|
||||||
struct passwd *root_pw = getpwnam ("root");
|
struct passwd *root_pw = getpwnam ("root");
|
||||||
|
Loading…
Reference in New Issue
Block a user