From: Karel Zak Date: Wed, 29 May 2013 09:32:58 +0000 (+0200) Subject: su: ignore --preserve-environment, it's mutually exclusive to --login X-Git-Tag: v2.24-rc1~529 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e5c0a2db233b726ca80d37aad9eeca8bae144d4;p=thirdparty%2Futil-linux.git su: ignore --preserve-environment, it's mutually exclusive to --login Addresses: http://bugs.gnu.org/10317 Reported-by: Bernhard Voelker Signed-off-by: Karel Zak --- diff --git a/login-utils/su-common.c b/login-utils/su-common.c index ba2a6166d2..a41d015934 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -810,6 +810,11 @@ su_main (int argc, char **argv, int mode) ++optind; } + if (simulate_login && !change_environment) { + warnx(_("ignore --preserve-environment, it's mutually exclusive to --login.")); + change_environment = true; + } + switch (su_mode) { case RUNUSER_MODE: if (runuser_user) { diff --git a/login-utils/su.1 b/login-utils/su.1 index c82b941ff7..eab1a6f7f3 100644 --- a/login-utils/su.1 +++ b/login-utils/su.1 @@ -98,6 +98,7 @@ Preserves the whole environment, ie does not set .B USER nor .BR LOGNAME . +The option is ignored if the option \fB\-\-login\fR is specified. .TP \fB\-s\fR \fISHELL\fR, \fB\-\-shell\fR=\fISHELL\fR Runs the specified shell instead of the default. The shell to run is