diff options
author | Anthony Martin <ality@pbrane.org> | 2010-06-28 14:32:29 -0700 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2010-06-28 14:32:29 -0700 |
commit | c988c8adf1d997d87ab792f68be0932fed74e9cd (patch) | |
tree | 8d768a6141e78fa2cf95c2e1f0f39aae11195467 /src/cmd/9term | |
parent | 670f730113743ef6ba4e093c56b812b6e4801314 (diff) | |
download | plan9port-c988c8adf1d997d87ab792f68be0932fed74e9cd.tar.gz plan9port-c988c8adf1d997d87ab792f68be0932fed74e9cd.tar.bz2 plan9port-c988c8adf1d997d87ab792f68be0932fed74e9cd.zip |
9term: fix getpts on linux
Openpty uses grantpt internally and its behavior is
unspecified when a handler is set to catch SIGCHLD.
Fixes issue 37. http://code.swtch.com/plan9port/issues/37
R=rsc
CC=codebot
http://codereview.appspot.com/1209049
Diffstat (limited to 'src/cmd/9term')
-rw-r--r-- | src/cmd/9term/Linux.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/9term/Linux.c b/src/cmd/9term/Linux.c index a9bf6f9a..449ddde6 100644 --- a/src/cmd/9term/Linux.c +++ b/src/cmd/9term/Linux.c @@ -1,13 +1,18 @@ #define getpts not_using_this_getpts #include "bsdpty.c" #undef getpts +#include <signal.h> int getpts(int fd[], char *slave) { + void (*f)(int); + + f = signal(SIGCHLD, SIG_DFL); if(openpty(&fd[1], &fd[0], NULL, NULL, NULL) >= 0){ fchmod(fd[1], 0620); strcpy(slave, ttyname(fd[0])); + signal(SIGCHLD, f); return 0; } sysfatal("no ptys"); |