aboutsummaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-07-25 18:25:29 +0200
committerDaniel Lange <DLange@git.local>2016-07-25 18:25:29 +0200
commitaed86a83b9120528c2a2a5c137d443917682d4b4 (patch)
tree979855616d56f2864dedc7b88798e9831614e9ee /linux/LinuxProcessList.c
parent6ca259100661aa0be46c8645773d32a8a6a5f312 (diff)
parent31b71b67011fa52f091df6fe536a11d6d0bfb256 (diff)
downloaddebian_htop-aed86a83b9120528c2a2a5c137d443917682d4b4.tar.gz
debian_htop-aed86a83b9120528c2a2a5c137d443917682d4b4.tar.bz2
debian_htop-aed86a83b9120528c2a2a5c137d443917682d4b4.zip
Merge tag 'upstream/2.0.2'
Upstream version 2.0.2
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r--linux/LinuxProcessList.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 1b1a0f3..712baa5 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -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;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy