X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fsignal-util.c;h=0be2ec0c708ee983a8abdefcf8430407d3f3d078;hp=b0ff4a6b761e57af5638dabcf6d5d00028c06b29;hb=fc5023c284153dba5a4b9c8eecc2147f9929899f;hpb=eaca07ccfdf5d7dabc50afc7e539c2413dd69d3e diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c index b0ff4a6b7..0be2ec0c7 100644 --- a/src/basic/signal-util.c +++ b/src/basic/signal-util.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -19,11 +17,16 @@ along with systemd; If not, see . ***/ +#include +#include +#include + +#include "macro.h" #include "parse-util.h" #include "signal-util.h" +#include "stdio-util.h" #include "string-table.h" #include "string-util.h" -#include "util.h" int reset_all_signal_handlers(void) { static const struct sigaction sa = { @@ -87,8 +90,7 @@ static int sigaction_many_ap(const struct sigaction *sa, int sig, va_list ap) { return r; } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind int sigaction_many(const struct sigaction *sa, ...) { va_list ap; int r; @@ -118,8 +120,7 @@ int ignore_signals(int sig, ...) { return r; } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind int default_signals(int sig, ...) { static const struct sigaction sa = { @@ -236,9 +237,9 @@ const char *signal_to_string(int signo) { return name; if (signo >= SIGRTMIN && signo <= SIGRTMAX) - snprintf(buf, sizeof(buf), "RTMIN+%d", signo - SIGRTMIN); + xsprintf(buf, "RTMIN+%d", signo - SIGRTMIN); else - snprintf(buf, sizeof(buf), "%d", signo); + xsprintf(buf, "%d", signo); return buf; } @@ -258,7 +259,7 @@ int signal_from_string(const char *s) { } if (safe_atou(s, &u) >= 0) { signo = (int) u + offset; - if (signo > 0 && signo < _NSIG) + if (SIGNAL_VALID(signo)) return signo; } return -EINVAL; @@ -276,8 +277,7 @@ int signal_from_string_try_harder(const char *s) { return signo; } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind void nop_signal_handler(int sig) { /* nothing here */ }