fix crash in proc_args if psinfo_t.pr_argc == 0

This commit is contained in:
Doug MacEachern 2005-09-12 23:52:02 +00:00
parent 9ec93a73ed
commit b2830cafbc
1 changed files with 5 additions and 0 deletions

View File

@ -704,6 +704,11 @@ int sigar_proc_args_get(sigar_t *sigar, sigar_pid_t pid,
} }
pinfo = sigar->pinfo; pinfo = sigar->pinfo;
if (pinfo->pr_argc == 0) {
procargs->number = procargs->size = 0;
return SIGAR_OK;
}
argv_size = sizeof(*argvp) * pinfo->pr_argc; argv_size = sizeof(*argvp) * pinfo->pr_argc;
(void)SIGAR_PROC_FILENAME(buffer, pid, "/as"); (void)SIGAR_PROC_FILENAME(buffer, pid, "/as");