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 /contrib/package/freifunk-watchdog/src | |
parent | 214511aafc65d340174c93703efd1e158b076be1 (diff) |
contrib/package: fix running check
Diffstat (limited to 'contrib/package/freifunk-watchdog/src')
-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 aea0516811..12d4badec3 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 */ |