提交 17d0bf64 编写于 作者: R Richard W.M. Jones

* 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.
上级 2b233a04
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册