system/stackmonitor/: Minor design improvement.
@@ -378,14 +378,9 @@ static int stackmonitor_daemon(int argc, char **argv)
* directories with (2) all numeric names.
*/
- if (!DIRENT_ISDIRECTORY(entryp->d_type) ||
- !stackmonitor_check_name(entryp->d_name))
+ if (DIRENT_ISDIRECTORY(entryp->d_type) &&
+ stackmonitor_check_name(entryp->d_name))
{
- /* Not a directory or not a numeric PID directory ... skip this entry */
-
- continue;
- }
-
/* Looks good -- process the directory */
ret = stkmon_process_directory(entryp);
@@ -393,7 +388,8 @@ static int stackmonitor_daemon(int argc, char **argv)
{
/* Failed to process the thread directory */
- fprintf(stderr, "Stack Monitor: Failed to process sub-directory: %s\n",
+ fprintf(stderr,
+ "Stack Monitor: Failed to process sub-directory: %s\n",
entryp->d_name);
if (++errcount > 100)
@@ -404,6 +400,7 @@ static int stackmonitor_daemon(int argc, char **argv)
}
}
}
+ }
closedir(dirp);
}
