aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-15 17:13:19 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-15 17:13:19 +0100
commit39f5ff83c63bcb4a61e49a9043d1daf202ad8240 (patch)
tree8def86b4df0b4b71ee457f693e1dd0b6d794e531 /src
parentc7d4216274f12314a06e8e79fa94fd5f9e33a70c (diff)
minor beautifications
Diffstat (limited to 'src')
-rw-r--r--src/mint/taler-mint-httpd_keystate.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/mint/taler-mint-httpd_keystate.c b/src/mint/taler-mint-httpd_keystate.c
index 3463143c5..0e5f82d72 100644
--- a/src/mint/taler-mint-httpd_keystate.c
+++ b/src/mint/taler-mint-httpd_keystate.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014 GNUnet e.V.
+ Copyright (C) 2014, 2015 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -449,9 +449,11 @@ handle_signal (int signal_number)
if (SIGUSR1 == signal_number)
{
- errno = 0;
- res = write (reload_pipe[1], &c, 1);
- if ((res < 0) && (EINTR != errno))
+ res = write (reload_pipe[1],
+ &c,
+ 1);
+ if ( (res < 0) &&
+ (EINTR != errno) )
{
GNUNET_break (0);
return;
@@ -476,6 +478,7 @@ int
TALER_MINT_key_reload_loop (void)
{
struct sigaction act;
+ struct sigaction rec;
if (0 != pipe (reload_pipe))
{
@@ -483,16 +486,20 @@ TALER_MINT_key_reload_loop (void)
"Failed to create pipe.\n");
return GNUNET_SYSERR;
}
- memset (&act, 0, sizeof (struct sigaction));
+ memset (&act,
+ 0,
+ sizeof (struct sigaction));
act.sa_handler = &handle_signal;
-
- if (0 != sigaction (SIGUSR1, &act, NULL))
+ if (0 != sigaction (SIGUSR1,
+ &act,
+ &rec))
{
fprintf (stderr,
"Failed to set signal handler.\n");
return GNUNET_SYSERR;
}
+ /* FIXME: allow for 'clean' termination or restart (#3474) */
while (1)
{
char c;
@@ -520,6 +527,15 @@ read_again:
if (EINTR == errno)
goto read_again;
}
+
+ if (0 != sigaction (SIGUSR1,
+ &rec,
+ &act))
+ {
+ fprintf (stderr,
+ "Failed to restore signal handler.\n");
+ return GNUNET_SYSERR;
+ }
return GNUNET_OK;
}
@@ -589,5 +605,4 @@ TALER_MINT_handler_keys (struct RequestHandler *rh,
}
-
/* end of taler-mint-httpd_keystate.c */