Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5c93f39
)
close master/slave pty in the shell process.
author
Aurélien Aptel <
[email protected]
>
Thu, 26 Aug 2010 19:36:21 +0000
(21:36 +0200)
committer
Aurélien Aptel <
[email protected]
>
Thu, 26 Aug 2010 19:36:21 +0000
(21:36 +0200)
st.c
patch
|
blob
|
history
diff --git
a/st.c
b/st.c
index
bef3039
..
e288902
100644
(file)
--- 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)
if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0)
die("openpt failed: %s\n", SERRNO);
if(grantpt(m) < 0)
- die("gran
d
pt failed: %s\n", SERRNO);
+ die("gran
t
pt failed: %s\n", SERRNO);
if(unlockpt(m) < 0)
die("unlockpt failed: %s\n", SERRNO);
if(!(pts = ptsname(m)))
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)
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:
execsh();
break;
default: