mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
* 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.
This commit is contained in:
parent
2b233a049e
commit
17d0bf6454
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -57,15 +57,23 @@ static int godaemon = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1655,6 +1663,7 @@ static int qemudOneLoop(struct qemud_server *server, int timeout) {
|
||||
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 */
|
||||
@ -1682,6 +1691,16 @@ static int qemudOneLoop(struct qemud_server *server, int timeout) {
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user