diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-04 17:21:46 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-04 17:21:46 +0000 |
commit | 970fe52726932081b11c4c19276d0bf3222b0f70 (patch) | |
tree | 707f53132292637da477cafb3173ad24278c4325 | |
parent | 214511aafc65d340174c93703efd1e158b076be1 (diff) |
contrib/package: fix running check
-rw-r--r-- | contrib/package/freifunk-watchdog/src/watchdog.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/package/freifunk-watchdog/src/watchdog.c b/contrib/package/freifunk-watchdog/src/watchdog.c index aea051681..12d4badec 100644 --- a/contrib/package/freifunk-watchdog/src/watchdog.c +++ b/contrib/package/freifunk-watchdog/src/watchdog.c @@ -111,7 +111,12 @@ static int find_process(const char *name) if( strstr(buffer, cmpname) == buffer ) { pid = atoi(entry->d_name); - break; + + /* Skip myself ... */ + if( pid == getpid() ) + pid = -1; + else + break; } } } @@ -339,7 +344,7 @@ int main(int argc, char *argv[]) /* Check if watchdog is running ... */ if( (argc > 1) && (strcmp(argv[1], "running") == 0) ) { - return (find_process(BINARY) >= 0); + return (find_process(BINARY) == -1); } /* Start daemon */ |