X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fforkpty.c;h=0bbf2de2746bba58d38b258428700320415706f8;hb=9a59faab3c0c46d2e96245e11fc71351caba1a2e;hp=2d1b0ae28e5f178f181a61fee214d5cd7a9a63f4;hpb=4921ce08673d14e53b3931b8536238d944a2c1ce;p=musl diff --git a/src/misc/forkpty.c b/src/misc/forkpty.c index 2d1b0ae2..0bbf2de2 100644 --- a/src/misc/forkpty.c +++ b/src/misc/forkpty.c @@ -1,5 +1,6 @@ #include #include +#include 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);