[sheepdog] [PATCH 1/2] collie: clean signal handler register
Hitoshi Mitake
mitake.hitoshi at gmail.com
Sun Feb 24 10:20:08 CET 2013
This patch does 2 trivial cleanings:
1. main() of collie doesn't need sa_old when it calls sigaction() for
registering handler of SIGABRT
2. print string representation of errno in crash_handler(). It should
print the value because abort() can be called with any reasons
other than out of memory.
Cc: Harry Wei <harryxiyou at gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
collie/collie.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/collie/collie.c b/collie/collie.c
index 15e24e6..5affb41 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -317,7 +317,7 @@ static const struct sd_option *build_sd_options(const char *opts)
static void crash_handler(int signo)
{
if (signo == SIGABRT)
- fprintf(stderr, "collie abort.\n");
+ fprintf(stderr, "collie abort. errno: %m\n");
else
fprintf(stderr, "collie got unexpected signal %d.\n", signo);
@@ -333,7 +333,6 @@ int main(int argc, char **argv)
const char *short_options;
char *p;
const struct sd_option *sd_opts;
- struct sigaction sa_old;
struct sigaction sa_new;
init_commands(&commands);
@@ -342,7 +341,7 @@ int main(int argc, char **argv)
sa_new.sa_flags = 0;
sigemptyset(&sa_new.sa_mask);
- sigaction(SIGABRT, &sa_new, &sa_old);
+ sigaction(SIGABRT, &sa_new, NULL);
if (argc < 3)
usage(commands, 0);
--
1.7.5.1
More information about the sheepdog
mailing list