Description: Use sigaction (instead of signal) BSD semantics has SA_RESTART, which kills a part of behaviors of ttyrec. Use sigaction for better control. * doinput should be interrupted * dooutput should not be interrupted Auther: NIIBE Yutaka Suggested-By: Joey Hess Reviewed-By: NIIBE Yutaka Last-Update: 2010-04-27 --- ttyrec-1.0.8.orig/ttyrec.c 2010-04-27 12:37:27.000000000 +0900 +++ ttyrec-1.0.8/ttyrec.c 2010-04-27 12:45:18.000000000 +0900 @@ -125,6 +125,7 @@ int argc; char *argv[]; { + struct sigaction sa; extern int optind; int ch; void finish(); @@ -168,7 +169,10 @@ getmaster(); fixtty(); - (void) signal(SIGCHLD, finish); + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = finish; + sigaction(SIGCHLD, &sa, NULL); child = fork(); if (child < 0) { perror("fork"); @@ -180,12 +184,16 @@ perror("fork"); fail(); } - if (child) + if (child) { + sa.sa_flags = SA_RESTART; + sigaction(SIGCHLD, &sa, NULL); dooutput(); - else + } else doshell(command); } - signal(SIGWINCH, resize); + sa.sa_handler = resize; + sa.sa_flags = SA_RESTART; + sigaction(SIGWINCH, &sa, NULL); doinput(); return 0;