Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
69355234
Commit
69355234
authored
Mar 05, 2018
by
Guy M. Broome
Committed by
Hisham Muhammad
Mar 16, 2018
Browse files
Solaris: fix memory allocation for usernames (some empty usernames in 32-bit builds)
parent
cefbe499
Changes
1
Show whitespace changes
Inline
Side-by-side
solaris/SolarisProcessList.c
View file @
69355234
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment