Commit 0f71db9d authored by Guy M. Broome's avatar Guy M. Broome Committed by Hisham Muhammad
Browse files

Solaris: fix memory allocation for usernames (some empty usernames in 32-bit builds)

parent da401078
......@@ -62,16 +62,6 @@ typedef struct SolarisProcessList_ {
}*/
static void setCommand(Process* process, const char* command, int len) {
if (process->comm && process->commLen >= len) {
strncpy(process->comm, command, len + 1);
} else {
free(process->comm);
process->comm = xStrdup(command);
}
process->commLen = len;
}
char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
char* zname;
if ( sproc->zoneid == 0 ) {
......@@ -326,7 +316,8 @@ void ProcessList_goThroughEntries(ProcessList* this) {
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
proc->nlwp = _psinfo.pr_nlwp;
proc->session = _pstatus.pr_sid;
setCommand(proc,_psinfo.pr_fname,PRFNSZ);
proc->comm = xStrdup(_psinfo.pr_fname);
proc->commLen = strnlen(_psinfo.pr_fname,PRFNSZ);
sproc->zname = SolarisProcessList_readZoneName(spl->kd,sproc);
proc->majflt = _prusage.pr_majf;
proc->minflt = _prusage.pr_minf;
......@@ -355,7 +346,8 @@ void ProcessList_goThroughEntries(ProcessList* this) {
proc->pgrp = _psinfo.pr_pgid;
proc->nlwp = _psinfo.pr_nlwp;
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
setCommand(proc,_psinfo.pr_fname,PRFNSZ);
proc->comm = xStrdup(_psinfo.pr_fname);
proc->commLen = strnlen(_psinfo.pr_fname,PRFNSZ);
sproc->zname = SolarisProcessList_readZoneName(spl->kd,sproc);
proc->majflt = _prusage.pr_majf;
proc->minflt = _prusage.pr_minf;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment