dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit e5c607a8e575d8b1a07ca6d0cbc80f2391cb440f
parent 780003719a09350115a3a3050cc2ab0e0bb8da76
Author: Rainer Müller <raimue@codingfarm.de>
Date:   Wed, 30 Apr 2008 00:06:23 +0200

Correct signal handling

The global errno variable needs to be saved at the begin of a signal handler
and to be restored at the end.

Signed-off-by: Rainer Müller <raimue@codingfarm.de>

Diffstat:
dvtm.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -758,15 +758,21 @@ get_client_by_pid(pid_t pid){ void sigchld_handler(int sig){ + int errsv = errno; + int child_status; signal(SIGCHLD, sigchld_handler); pid_t pid = wait(&child_status); debug("child with pid %d died\n", pid); client_killed = get_client_by_pid(pid); + + errno = errsv; } void sigwinch_handler(int sig){ + int errsv = errno; + struct winsize ws; signal(SIGWINCH, sigwinch_handler); if(ioctl(0, TIOCGWINSZ, &ws) == -1) @@ -775,6 +781,8 @@ sigwinch_handler(int sig){ width = ws.ws_col; height = ws.ws_row; need_screen_resize = true; + + errno = errsv; } void