aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-08-26 21:36:21 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-08-26 21:36:21 +0200
commit1494bb9f978069fc19d4900ed4d19b0e77fe8110 (patch)
tree9b4ba5ddd893780c31fd84ce2b181a18177d343e /st.c
parentab5e72dc3940e640c635a149dda035137d0e966f (diff)
downloadst-1494bb9f978069fc19d4900ed4d19b0e77fe8110.tar.gz
st-1494bb9f978069fc19d4900ed4d19b0e77fe8110.tar.bz2
close master/slave pty in the shell process.
Diffstat (limited to 'st.c')
-rw-r--r--st.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/st.c b/st.c
index bef3039..e288902 100644
--- a/st.c
+++ b/st.c
@@ -247,7 +247,7 @@ ttynew(void) {
if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0)
die("openpt failed: %s\n", SERRNO);
if(grantpt(m) < 0)
- die("grandpt failed: %s\n", SERRNO);
+ die("grantpt failed: %s\n", SERRNO);
if(unlockpt(m) < 0)
die("unlockpt failed: %s\n", SERRNO);
if(!(pts = ptsname(m)))
@@ -265,7 +265,9 @@ ttynew(void) {
dup2(s, STDOUT_FILENO);
dup2(s, STDERR_FILENO);
if(ioctl(s, TIOCSCTTY, NULL) < 0)
- die("ioctl TTIOCSTTY failed: %s\n", SERRNO);
+ die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
+ close(s);
+ close(m);
execsh();
break;
default: