]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su: ignore --preserve-environment, it's mutually exclusive to --login
authorKarel Zak <kzak@redhat.com>
Wed, 29 May 2013 09:32:58 +0000 (11:32 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 29 May 2013 09:32:58 +0000 (11:32 +0200)
Addresses: http://bugs.gnu.org/10317
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/su-common.c
login-utils/su.1

index ba2a6166d2b21903a67d926f6d5f87ef9bb6796b..a41d015934d085488f0117302562b37c9d27298a 100644 (file)
@@ -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) {
index c82b941ff7c95b8bb95dfc50734f7a848987391f..eab1a6f7f3bd99ed663086d2adfe1c6f810cff32 100644 (file)
@@ -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