summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2017-08-23 13:50:04 +0200
committerKarel Zak2017-09-18 11:49:11 +0200
commit927ded6be6bddefb57909a1c24255ac23643b6dc (patch)
treef30ee70c21e8733a6e8bd9ac3545c5e903518548 /login-utils
parentsu: add more informartion to man page (diff)
downloadkernel-qcow2-util-linux-927ded6be6bddefb57909a1c24255ac23643b6dc.tar.gz
kernel-qcow2-util-linux-927ded6be6bddefb57909a1c24255ac23643b6dc.tar.xz
kernel-qcow2-util-linux-927ded6be6bddefb57909a1c24255ac23643b6dc.zip
su: enable TIOCSCTTY and minor changes
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/su-common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index 7725d1558..6c5c6eb77 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -227,7 +227,7 @@ static void pty_init_slave(struct su_context *su)
{
DBG(PTY, ul_debug("initialize slave"));
- ioctl(su->pty_slave, TIOCSCTTY, 0);
+ ioctl(su->pty_slave, TIOCSCTTY, 1);
close(su->pty_master);
dup2(su->pty_slave, STDIN_FILENO);
@@ -1074,7 +1074,7 @@ static void usage_common(void)
" and do not create a new session\n"), stdout);
fputs(_(" -f, --fast pass -f to the shell (for csh or tcsh)\n"), stdout);
fputs(_(" -s, --shell <shell> run <shell> if /etc/shells allows it\n"), stdout);
- fputs(_(" -P, --pty create pseudo-terminal session\n"), stdout);
+ fputs(_(" -P, --pty create a new pseudo-terminal\n"), stdout);
fputs(USAGE_SEPARATOR, stdout);
printf(USAGE_HELP_OPTIONS(33));
@@ -1386,8 +1386,10 @@ int su_main(int argc, char **argv, int mode)
/* Now we're in the child. */
change_identity(su->pwd);
- if (!su->same_session || su->pty)
+ if (!su->same_session || su->pty) {
+ DBG(MISC, ul_debug("call setsid()"));
setsid();
+ }
if (su->pty)
pty_init_slave(su);