* NEWS, src/userdel.c, src/lastlog.c, src/gpasswd.c,
src/newusers.c, src/chpasswd.c, src/groupmems.c, src/usermod.c, src/chgpasswd.c, src/vipw.c, src/su.c, src/useradd.c, src/groupmod.c, src/passwd.c, src/groupadd.c, src/chage.c, src/faillog.c, src/chsh.c: If someone uses the -h/--help options, the usage should not go to stderr nor should the utility exit with non-zero status. All of the shadow utils do just this unfortunately, so convert them over to sanity. * man/groupmems.8.xml, man/gpasswd.1.xml: Added option -h/--help.
This commit is contained in:
10
src/su.c
10
src/su.c
@ -323,7 +323,7 @@ static void run_shell (const char *shellstr, char *args[], bool doshell,
|
||||
/*
|
||||
* usage - print command line syntax and exit
|
||||
*/
|
||||
static void usage (void)
|
||||
static void usage (int status)
|
||||
{
|
||||
fputs (_("Usage: su [options] [LOGIN]\n"
|
||||
"\n"
|
||||
@ -335,8 +335,8 @@ static void usage (void)
|
||||
" --preserve-environment do not reset environment variables, and\n"
|
||||
" keep the same shell\n"
|
||||
" -s, --shell SHELL use SHELL instead of the default in passwd\n"
|
||||
"\n"), stderr);
|
||||
exit (E_USAGE);
|
||||
"\n"), status ? stderr : stdout);
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -421,7 +421,7 @@ int main (int argc, char **argv)
|
||||
command = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
usage ();
|
||||
usage (E_SUCCESS);
|
||||
break;
|
||||
case 'l':
|
||||
fakelogin = true;
|
||||
@ -438,7 +438,7 @@ int main (int argc, char **argv)
|
||||
shellstr = optarg;
|
||||
break;
|
||||
default:
|
||||
usage (); /* NOT REACHED */
|
||||
usage (E_USAGE); /* NOT REACHED */
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user