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
90518bfc
Commit
90518bfc
authored
Feb 10, 2019
by
Hisham Muhammad
Browse files
Return of snprintf is not the number of written bytes
parent
f49f5458
Changes
1
Show whitespace changes
Inline
Side-by-side
Process.c
View file @
90518bfc
...
@@ -414,11 +414,16 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
...
@@ -414,11 +414,16 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
if
(
indent
&
(
1U
<<
i
))
if
(
indent
&
(
1U
<<
i
))
maxIndent
=
i
+
1
;
maxIndent
=
i
+
1
;
for
(
int
i
=
0
;
i
<
maxIndent
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
maxIndent
-
1
;
i
++
)
{
int
written
;
int
written
,
ret
;
if
(
indent
&
(
1
<<
i
))
if
(
indent
&
(
1
<<
i
))
written
=
snprintf
(
buf
,
n
,
"%s "
,
CRT_treeStr
[
TREE_STR_VERT
]);
ret
=
snprintf
(
buf
,
n
,
"%s "
,
CRT_treeStr
[
TREE_STR_VERT
]);
else
else
written
=
snprintf
(
buf
,
n
,
" "
);
ret
=
snprintf
(
buf
,
n
,
" "
);
if
(
ret
<
0
||
ret
>=
n
)
{
written
=
n
;
}
else
{
written
=
ret
;
}
buf
+=
written
;
buf
+=
written
;
n
-=
written
;
n
-=
written
;
}
}
...
...
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