diff options
authorSven Eden <>2018-11-12 08:57:49 +0100
committerSven Eden <>2018-11-12 08:57:49 +0100
commitd4a3f291e3955648ea1d29e674b0f8f9b1556257 (patch)
parent693b0f31439318d68c5a42e79f7e8a751b4cffb3 (diff)
Prep v239.2: Handle program_invocation_short_name more properly (#92)
With glibc, at least v2.28, program_invocation_short_name is not a string of its own, but simply points into program_invocation_name. When elogind is forked, the fork process gets a new name. Upstream has decided to change to long version, which is the correct thing to do. Unfortunately program_invocation_short_name is not adapted, and all further log messages using it might print anything. This patch manipulates program_invocation_short_name if its adress lies within program_invocation_name and its original length. Bug: #92 Closes: #92 Signed-off-by: Sven Eden <>
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 366aabba8..3930aa62b 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -308,6 +308,12 @@ int rename_process(const char name[]) {
strncpy(program_invocation_name, name, k);
if (l > k)
truncated = true;
+#if 1 /// elogind takes care of situations where the short name points into the long.
+ if ( (program_invocation_short_name >= program_invocation_name)
+ && (program_invocation_short_name < program_invocation_name + k) )
+ program_invocation_short_name = program_invocation_name;
+#endif // 1
/* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but