gluon-radv-filterd: Ship with own implementation of error()
This commit is contained in:
parent
5a4dc1f983
commit
3bf4d12911
@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <error.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -123,6 +122,18 @@ struct global {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void error(int status, int errnum, char *message, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, message);
|
||||||
|
fflush(stdout);
|
||||||
|
vfprintf(stderr, message, ap);
|
||||||
|
if (errnum)
|
||||||
|
fprintf(stderr, ": %s", strerror(errnum));
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
if (status)
|
||||||
|
exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
static void cleanup() {
|
static void cleanup() {
|
||||||
struct router *router;
|
struct router *router;
|
||||||
close(G.sock);
|
close(G.sock);
|
||||||
@ -464,7 +475,7 @@ static int fork_execvp_timeout(struct timespec *timeout, const char *file, const
|
|||||||
if (ret == SIGCHLD) {
|
if (ret == SIGCHLD) {
|
||||||
if (info.si_pid != child) {
|
if (info.si_pid != child) {
|
||||||
cleanup();
|
cleanup();
|
||||||
error_at_line(1, 0, __FILE__, __LINE__,
|
error(1, 0,
|
||||||
"BUG: We received a SIGCHLD from a child we didn't spawn (expected PID %d, got %d)",
|
"BUG: We received a SIGCHLD from a child we didn't spawn (expected PID %d, got %d)",
|
||||||
child, info.si_pid);
|
child, info.si_pid);
|
||||||
}
|
}
|
||||||
@ -479,8 +490,8 @@ static int fork_execvp_timeout(struct timespec *timeout, const char *file, const
|
|||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
warn_errno("sigtimedwait failed, killing child");
|
warn_errno("sigtimedwait failed, killing child");
|
||||||
else
|
else
|
||||||
error_at_line(1, 0, __FILE__, __LINE__,
|
error(1, 0,
|
||||||
"BUG: sigtimedwait() return some other signal than SIGCHLD: %d",
|
"BUG: sigtimedwait() returned some other signal than SIGCHLD: %d",
|
||||||
ret);
|
ret);
|
||||||
|
|
||||||
kill(child, SIGKILL);
|
kill(child, SIGKILL);
|
||||||
|
Loading…
Reference in New Issue
Block a user