Skip to content

Commit

Permalink
Fixed process_dead() stupidity.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 31, 2008
1 parent c8d9853 commit 18748e3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions nph-offload.c
Expand Up @@ -87,6 +87,7 @@
#include <semaphore.h>
#include <limits.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -471,11 +472,7 @@ static list *loadMetadata(const char *fname)

static int process_dead(int pid)
{
// !!! FIXME: Linux specific!
struct stat statbuf;
char fname[64];
snprintf(fname, sizeof (fname), "/proc/%d", pid);
return ((stat(fname, &statbuf) == -1) || (S_ISDIR(statbuf.st_mode)) == 0);
return ( (pid <= 0) || ((kill(pid, 0) == -1) && (errno == ESRCH)) );
} // process_dead


Expand Down

0 comments on commit 18748e3

Please sign in to comment.