diff options
author | Guillem Jover <guillem@debian.org> | 2013-01-20 02:33:13 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-04-14 05:50:17 +0200 |
commit | dabcb9560063a134a01c4223b1d6fa3624175daa (patch) | |
tree | 82301056f17ddde346d06089eef832ce1ad0be8b /dselect/baselist.cc | |
parent | 0790f370e789197b2493b8cd1746374dca9b8316 (diff) | |
download | dpkg-dabcb9560063a134a01c4223b1d6fa3624175daa.tar.gz |
dselect: Save and restore errno on signal handler
This makes sure that the signal function will not stomp over an errno
value already set when interrupted.
The signal handler is still not async-safe, but this at least fixes one
of the problems.
Diffstat (limited to 'dselect/baselist.cc')
-rw-r--r-- | dselect/baselist.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/dselect/baselist.cc b/dselect/baselist.cc index ee4969618..1ee0c9090 100644 --- a/dselect/baselist.cc +++ b/dselect/baselist.cc @@ -4,6 +4,7 @@ * * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk> * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org> + * Copyright © 2007-2013 Guillem Jover <guillem@debian.org> * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +27,7 @@ #include <sys/termios.h> #include <assert.h> +#include <errno.h> #include <ctype.h> #include <string.h> #include <unistd.h> @@ -49,6 +51,7 @@ void mywerase(WINDOW *win) { baselist *baselist::signallist= 0; void baselist::sigwinchhandler(int) { + int save_errno = errno; struct winsize size; debug(dbg_general, "baselist::sigwinchhandler(), signallist=%p", signallist); baselist *p= signallist; @@ -58,6 +61,7 @@ void baselist::sigwinchhandler(int) { resizeterm(size.ws_row, size.ws_col); wrefresh(curscr); p->startdisplay(); if (doupdate() == ERR) ohshite(_("doupdate in SIGWINCH handler failed")); + errno = save_errno; } static void cu_sigwinch(int, void **argv) { |