From 6abfd933e73966931fb37471f15f91ffc42c23b6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Oct 2003 00:09:23 +0000 Subject: many fixes git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@52 2bf48fe7-cfc1-0310-909f-d9042e1e0fef --- src/ifplugd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/ifplugd.c') diff --git a/src/ifplugd.c b/src/ifplugd.c index 18c883b..322870f 100644 --- a/src/ifplugd.c +++ b/src/ifplugd.c @@ -221,8 +221,6 @@ int action(interface_status_t status) { daemon_log(LOG_WARNING, "Killing child."); kill(pid, SIGTERM); } - - break; } } @@ -579,7 +577,7 @@ void work(void) { } cleanup: - if (!no_shutdown_script && status == IFSTATUS_UP) { + if (!no_shutdown_script && (status == IFSTATUS_UP || (status == IFSTATUS_DOWN && t))) { setenv(IFPLUGD_ENV_PREVIOUS, strstatus(status), 1); setenv(IFPLUGD_ENV_CURRENT, strstatus(-1), 1); action(IFSTATUS_DOWN); @@ -833,12 +831,13 @@ void parse_args(int argc, char *argv[]) { if (_check) { pid_t pid = daemon_pid_file_is_running(); - if (pid == (pid_t) -1) + if (pid == (pid_t) -1 || pid == 0) { printf("ifplugd not running.\n"); - else + exit(255); + } else { printf("ifplugd process for device %s running as pid %u.\n", interface, pid); - - exit(pid == 0 ? 255 : 0); + exit(0); + } } } -- cgit