OSDN Git Service
(root)
/
android-x86
/
external-musl-libc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4921ce0
)
properly create new session/controlling terminal in forkpty
author
Rich Felker
<dalias@aerifal.cx>
Thu, 21 Apr 2011 01:01:42 +0000
(21:01 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 21 Apr 2011 01:01:42 +0000
(21:01 -0400)
src/misc/forkpty.c
patch
|
blob
|
history
diff --git
a/src/misc/forkpty.c
b/src/misc/forkpty.c
index
2d1b0ae
..
0bbf2de
100644
(file)
--- a/
src/misc/forkpty.c
+++ b/
src/misc/forkpty.c
@@
-1,5
+1,6
@@
#include <pty.h>
#include <unistd.h>
+#include <sys/ioctl.h>
int forkpty(int *m, char *name, const struct termios *tio, const struct winsize *ws)
{
@@
-10,10
+11,12
@@
int forkpty(int *m, char *name, const struct termios *tio, const struct winsize
pid = fork();
if (!pid) {
close(*m);
+ setsid();
+ ioctl(s, TIOCSCTTY, (char *)0);
dup2(s, 0);
dup2(s, 1);
dup2(s, 2);
- close(s);
+
if (s>2)
close(s);
return 0;
}
close(s);