From: lace <> Date: Thu, 12 Apr 2007 19:22:18 +0000 (+0000) Subject: state(): Handle some races. X-Git-Url: http://git.jankratochvil.net/?p=debugger.git;a=commitdiff_plain;h=da6b0f102bb60e5b73d0dd0c5555a16f7f7a5109 state(): Handle some races. --- diff --git a/debugger.c b/debugger.c index 81a3bd4..457df84 100644 --- a/debugger.c +++ b/debugger.c @@ -102,7 +102,10 @@ static enum state state_get (pid_t pid) if (f == NULL && errno == ENOENT) found = STATE_ENOENT; else if (f == NULL) - crash (); + { + fprintf (stderr, "errno = %d\n", errno); + crash (); + } else { int i; @@ -131,9 +134,7 @@ static enum state state_get (pid_t pid) crash (); } } - if (errno == ESRCH) - return found; - assert (found != STATE_INSTABLE); + assert (found != STATE_INSTABLE || errno == ESRCH); i = fclose (f); assert (i == 0); }