+Tue Mar 27 11:26:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
+
+ * qemud/qemud.c: If using FORTIFY_SOURCE, remove warning
+ warn_unused_result by counting errors found in signal
+ handler and logging them in the main loop.
+
Mon Mar 26 11:29:43 CEST 2007 Daniel Veillard <veillard@redhat.com>
* acinclude.m4: applied patch from Jim Meyering to avoid clobbering
static int verbose = 0;
static int sigwrite = -1;
+static sig_atomic_t sig_errors = 0;
+static int sig_lasterrno = 0;
+
static void sig_handler(int sig) {
unsigned char sigc = sig;
int origerrno;
+ int r;
if (sig == SIGCHLD) /* We explicitly waitpid the child later */
return;
origerrno = errno;
- write(sigwrite, &sigc, 1);
+ r = write(sigwrite, &sigc, 1);
+ if (r == -1) {
+ sig_errors++;
+ sig_lasterrno = errno;
+ }
errno = origerrno;
}
struct pollfd fds[nfds];
int thistimeout = -1;
int ret;
+ sig_atomic_t errors;
/* If we have no clients or vms, then timeout after
30 seconds, letting daemon exit */
return -1;
}
+ /* Check for any signal handling errors and log them. */
+ errors = sig_errors;
+ if (errors) {
+ sig_errors -= errors;
+ qemudLog (QEMUD_ERR,
+ "Signal handler reported %d errors: last error: %s",
+ errors, strerror (sig_lasterrno));
+ return -1;
+ }
+
if (qemudDispatchPoll(server, fds) < 0)
return -1;