From: Jo-Philipp Wich Date: Mon, 4 May 2009 17:21:46 +0000 (+0000) Subject: contrib/package: fix running check X-Git-Tag: 0.9.0~488 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=970fe52726932081b11c4c19276d0bf3222b0f70;p=oweals%2Fluci.git contrib/package: fix running check --- 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 */