+2011-10-11 Pedro Alves <pedro@codesourcery.com>
+
+ * linux-nat.c (linux_lwp_is_zombie): Return early if the LWP is
+ not zombie instead of reading the whole file.
+
2011-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix separate debuginfo warning with "remote:" access.
{
char buffer[MAXPATHLEN];
FILE *procfile;
- int retval = 0;
+ int retval;
+ int have_state;
xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
procfile = fopen (buffer, "r");
warning (_("unable to open /proc file '%s'"), buffer);
return 0;
}
+
+ have_state = 0;
while (fgets (buffer, sizeof (buffer), procfile) != NULL)
- if (strcmp (buffer, "State:\tZ (zombie)\n") == 0)
+ if (strncmp (buffer, "State:", 6) == 0)
{
- retval = 1;
+ have_state = 1;
break;
}
+ retval = (have_state
+ && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
fclose (procfile);
-
return retval;
}