summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2013-05-29 11:32:58 +0200
committerKarel Zak2013-05-29 11:32:58 +0200
commit3e5c0a2db233b726ca80d37aad9eeca8bae144d4 (patch)
tree9abf9c0c79ae2e89fc9cbd2c12df7d8f7f7ae13a
parentlogger: small coding style changes (diff)
downloadkernel-qcow2-util-linux-3e5c0a2db233b726ca80d37aad9eeca8bae144d4.tar.gz
kernel-qcow2-util-linux-3e5c0a2db233b726ca80d37aad9eeca8bae144d4.tar.xz
kernel-qcow2-util-linux-3e5c0a2db233b726ca80d37aad9eeca8bae144d4.zip
su: ignore --preserve-environment, it's mutually exclusive to --login
Addresses: http://bugs.gnu.org/10317 Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--login-utils/su-common.c5
-rw-r--r--login-utils/su.11
2 files changed, 6 insertions, 0 deletions
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index ba2a6166d..a41d01593 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 c82b941ff..eab1a6f7f 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