On Tue, 21 Jan 2020 00:32:18 +0100 Willem Mulder <14mrh4...@gmail.com>
wrote:
> [...]
> I took the liberty of adding the patch and creating a debdiff of it
> (which you'll find below my signature).

Of course my mail client would mess up the formatting. Here's the patch
as an attachment.

Willem
diff -Nru htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch
--- htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch	1970-01-01 01:00:00.000000000 +0100
+++ htop-2.2.0/debian/patches/812-fix-process-name-updates-for-shorter-strings.patch	2020-01-07 00:41:53.000000000 +0100
@@ -0,0 +1,24 @@
+From b9c0d6d87c5b0bf7baf81370de02c5f9b62ffb7a Mon Sep 17 00:00:00 2001
+From: Score_Under <seejay...@gmail.com>
+Date: Tue, 10 Jul 2018 21:17:49 +0100
+Subject: [PATCH] Fix process name updates for shorter strings
+
+When a process name changes from a long string to a short string,
+truncate instead of just overwriting the beginning.
+---
+ linux/LinuxProcessList.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
+index 2edd0425..27ead28a 100644
+--- a/linux/LinuxProcessList.c
++++ b/linux/LinuxProcessList.c
+@@ -709,7 +709,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
+    }
+    command[lastChar + 1] = '\0';
+    process->basenameOffset = tokenEnd;
+-   setCommand(process, command, lastChar);
++   setCommand(process, command, lastChar + 1);
+ 
+    return true;
+ }
diff -Nru htop-2.2.0/debian/patches/series htop-2.2.0/debian/patches/series
--- htop-2.2.0/debian/patches/series	2018-04-26 20:59:57.000000000 +0200
+++ htop-2.2.0/debian/patches/series	2020-01-07 00:38:51.000000000 +0100
@@ -1,2 +1,3 @@
 780-fix-option-string.patch
 fix-linux-process.patch
+812-fix-process-name-updates-for-shorter-strings.patch

Reply via email to