summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-04 17:21:46 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-04 17:21:46 +0000
commit970fe52726932081b11c4c19276d0bf3222b0f70 (patch)
tree707f53132292637da477cafb3173ad24278c4325 /contrib/package/freifunk-watchdog
parent214511aafc65d340174c93703efd1e158b076be1 (diff)
contrib/package: fix running check
Diffstat (limited to 'contrib/package/freifunk-watchdog')
-rw-r--r--contrib/package/freifunk-watchdog/src/watchdog.c9
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 */