aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-05 17:33:48 +0200
committerMattias Andrée <maandree@kth.se>2016-08-05 17:33:48 +0200
commita57d3236793aa204f0a21f93435d642108438bca (patch)
treec52a172f8f5e92106b98ebf7312f8298cc673fca
parentFix disconnect/reconnect bugs (diff)
downloadcoopgammad-a57d3236793aa204f0a21f93435d642108438bca.tar.gz
coopgammad-a57d3236793aa204f0a21f93435d642108438bca.tar.bz2
coopgammad-a57d3236793aa204f0a21f93435d642108438bca.tar.xz
Fix signal handlers: restore errno
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--src/coopgammad.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/coopgammad.c b/src/coopgammad.c
index ddb98ad..dd0c9c2 100644
--- a/src/coopgammad.c
+++ b/src/coopgammad.c
@@ -117,8 +117,10 @@ char* restrict socketpath = NULL;
*/
static void sig_reexec(int signo)
{
+ int saved_errno = errno;
reexec = 1;
signal(signo, sig_reexec);
+ errno = saved_errno;
}
@@ -144,8 +146,10 @@ static void sig_terminate(int signo)
*/
static void sig_connection(int signo)
{
+ int saved_errno = errno;
connection = signo - SIGRTMIN + 1;
signal(signo, sig_connection);
+ errno = saved_errno;
}