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
1a13b4d0
Commit
1a13b4d0
authored
Jun 15, 2016
by
Hisham
Browse files
Don't store invisible trailing whitespace
parent
ea9dc4ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/LinuxProcessList.c
View file @
1a13b4d0
...
...
@@ -470,6 +470,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
int
amtRead
=
xread
(
fd
,
command
,
sizeof
(
command
)
-
1
);
close
(
fd
);
int
tokenEnd
=
0
;
int
lastChar
=
0
;
if
(
amtRead
>
0
)
{
for
(
int
i
=
0
;
i
<
amtRead
;
i
++
)
if
(
command
[
i
]
==
'\0'
||
command
[
i
]
==
'\n'
)
{
...
...
@@ -477,14 +478,16 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
tokenEnd
=
i
;
}
command
[
i
]
=
' '
;
}
else
{
lastChar
=
i
;
}
}
if
(
tokenEnd
==
0
)
{
tokenEnd
=
amtRead
;
}
command
[
amtRead
]
=
'\0'
;
command
[
lastChar
+
1
]
=
'\0'
;
process
->
basenameOffset
=
tokenEnd
;
setCommand
(
process
,
command
,
amtRead
);
setCommand
(
process
,
command
,
lastChar
+
1
);
return
true
;
}
...
...
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