commit c988c8adf1d997d87ab792f68be0932fed74e9cd from: Anthony Martin via: Russ Cox date: Mon Jun 28 21:32:29 2010 UTC 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 commit - 670f730113743ef6ba4e093c56b812b6e4801314 commit + c988c8adf1d997d87ab792f68be0932fed74e9cd blob - 4a200cdc12cbb393ae284852a6646139186f942e blob + 21efdc2df7658b7db01d01f3452c964a5ad0722c --- CONTRIBUTORS +++ CONTRIBUTORS @@ -5,6 +5,7 @@ Albert Lee André Günther +Anthony Martin Anthony Sorace Arvindh Rajesh Tamilmani Benjamin Huntsman blob - a9bf6f9a9d101958413c25df0f1cd8e1126e8c3c blob + 449ddde67cdc5fe25d688ae9ca3804d0de9a3b43 --- src/cmd/9term/Linux.c +++ src/cmd/9term/Linux.c @@ -1,13 +1,18 @@ #define getpts not_using_this_getpts #include "bsdpty.c" #undef getpts +#include 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");