Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
34b89a97
Commit
34b89a97
authored
11 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Add sanity checks.
parent
823bdbae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ProcessList.c
+3
-2
ProcessList.c
with
3 additions
and
2 deletions
+3
-2
ProcessList.c
View file @
34b89a97
...
...
@@ -217,7 +217,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
fgets
(
buffer
,
255
,
file
);
}
while
(
String_startsWith
(
buffer
,
"cpu"
));
fclose
(
file
);
this
->
cpuCount
=
cpus
-
1
;
this
->
cpuCount
=
MAX
(
cpus
-
1
,
1
)
;
#ifdef HAVE_LIBHWLOC
this
->
topologyOk
=
false
;
...
...
@@ -724,7 +724,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
time_t
curTime
=
tv
.
tv_sec
;
#ifdef HAVE_TASKSTATS
unsigned
long
long
now
=
tv
.
tv_sec
*
1000
+
tv
.
tv_usec
/
1000
;
unsigned
long
long
now
=
tv
.
tv_sec
*
1000
LL
+
tv
.
tv_usec
/
1000
LL
;
#endif
dir
=
opendir
(
dirname
);
...
...
@@ -884,6 +884,7 @@ void ProcessList_scan(ProcessList* this) {
CRT_fatalError
(
"Cannot open "
PROCMEMINFOFILE
);
}
int
cpus
=
this
->
cpuCount
;
assert
(
cpus
>
0
);
{
char
buffer
[
128
];
while
(
fgets
(
buffer
,
128
,
file
))
{
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help