gluon-radv-filterd: rename error() -> error_message()

This commit is contained in:
Jan-Philipp Litza 2017-08-20 14:25:54 +02:00
parent 5b34931a97
commit 0aca838f37
No known key found for this signature in database
GPG Key ID: 1FB658053CE27196

View File

@ -118,7 +118,7 @@ struct global {
}; };
static void error(int status, int errnum, char *message, ...) { static void error_message(int status, int errnum, char *message, ...) {
va_list ap; va_list ap;
va_start(ap, message); va_start(ap, message);
fflush(stdout); fflush(stdout);
@ -173,11 +173,11 @@ static void usage(const char *msg) {
static inline void exit_errno(const char *message) { static inline void exit_errno(const char *message) {
cleanup(); cleanup();
error(1, errno, "error: %s", message); error_message(1, errno, "error: %s", message);
} }
static inline void warn_errno(const char *message) { static inline void warn_errno(const char *message) {
error(0, errno, "warning: %s", message); error_message(0, errno, "warning: %s", message);
} }
static int init_packet_socket(unsigned int ifindex) { static int init_packet_socket(unsigned int ifindex) {
@ -468,7 +468,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(1, 0, error_message(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,11 +479,11 @@ static int fork_execvp_timeout(struct timespec *timeout, const char *file, const
} }
if (ret < 0 && errno == EAGAIN) if (ret < 0 && errno == EAGAIN)
error(0, 0, "warning: child %d took too long, killing", child); error_message(0, 0, "warning: child %d took too long, killing", child);
else if (ret < 0) else if (ret < 0)
warn_errno("sigtimedwait failed, killing child"); warn_errno("sigtimedwait failed, killing child");
else else
error(1, 0, error_message(1, 0,
"BUG: sigtimedwait() returned some other signal than SIGCHLD: %d", "BUG: sigtimedwait() returned some other signal than SIGCHLD: %d",
ret); ret);
@ -528,10 +528,10 @@ static void update_ebtables() {
if (fork_execvp_timeout(&timeout, "ebtables", (const char *[]) if (fork_execvp_timeout(&timeout, "ebtables", (const char *[])
{ "ebtables", "-F", G.chain, NULL })) { "ebtables", "-F", G.chain, NULL }))
error(0, 0, "warning: flushing ebtables chain %s failed, not adding a new rule", G.chain); error_message(0, 0, "warning: flushing ebtables chain %s failed, not adding a new rule", G.chain);
else if (fork_execvp_timeout(&timeout, "ebtables", (const char *[]) else if (fork_execvp_timeout(&timeout, "ebtables", (const char *[])
{ "ebtables", "-A", G.chain, "-s", mac, "-j", "ACCEPT", NULL })) { "ebtables", "-A", G.chain, "-s", mac, "-j", "ACCEPT", NULL }))
error(0, 0, "warning: adding new rule to ebtables chain %s failed", G.chain); error_message(0, 0, "warning: adding new rule to ebtables chain %s failed", G.chain);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {