summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorMark Hindley <mark@hindley.org.uk>2018-11-09 12:59:55 +0000
committerMark Hindley <mark@hindley.org.uk>2018-11-09 12:59:55 +0000
commitab1ab751ad58bce500a8e1e565a6567880e4ab71 (patch)
tree66346577f9c5fbfdd0c90d4027c4b0894faa5913 /debian/patches
parentb06a11345f09f22eaebfb084b65567fd54d98787 (diff)
parent0283a93cb8e00114a29e630b4ff7867a819d5bd5 (diff)
Merge branch 'Upstream_fix_issue_92' into merge_rc2
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff63
1 files changed, 27 insertions, 36 deletions
diff --git a/debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff b/debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff
index 5f1868272..034bf292b 100644
--- a/debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff
+++ b/debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff
@@ -3,44 +3,35 @@ Bug: https://github.com/elogind/elogind/issues/92
--- a/src/shared/musl_missing.c
+++ b/src/shared/musl_missing.c
-@@ -34,9 +34,14 @@
+@@ -26,14 +26,14 @@
+ #if HAVE_PROGRAM_INVOCATION_NAME == 0
+ char *program_invocation_name = NULL;
+ char *program_invocation_short_name = NULL;
+-#endif // libc does not provide these variables
- static void elogind_free_program_name(void) {
+-const char *program_arg_name = NULL;
++const char *program_arg_name = NULL; /* Helper */
++#endif // libc does not provide program_invocation_[short_]name
+
+ #include "musl_missing.h"
-- if (program_invocation_name && (program_invocation_name != program_arg_name) && strlen(program_invocation_name))
-+ if (program_invocation_name &&
-+ (program_invocation_name != program_arg_name) &&
-+ strlen(program_invocation_name))
++#if HAVE_PROGRAM_INVOCATION_NAME == 0
+ static void elogind_free_program_name(void) {
+-
+ if (program_invocation_name && (program_invocation_name != program_arg_name) && strlen(program_invocation_name))
program_invocation_name = mfree(program_invocation_name);
-- if (program_invocation_short_name && (program_invocation_short_name != program_arg_name) && strlen(program_invocation_short_name))
-+ if (program_invocation_short_name &&
-+ (program_invocation_short_name != program_arg_name) &&
-+ (program_invocation_short_name + strlen(program_invocation_short_name) != program_invocation_name + strlen(program_invocation_name))
-+ && strlen(program_invocation_short_name))
- program_invocation_short_name = mfree(program_invocation_short_name);
+ if (program_invocation_short_name && (program_invocation_short_name != program_arg_name) && strlen(program_invocation_short_name))
+@@ -55,8 +55,11 @@
+ program_invocation_name = strdup(program_arg_name);
+ if (NULL == program_invocation_short_name)
+ program_invocation_short_name = strdup(basename(program_arg_name));
+-#if HAVE_PROGRAM_INVOCATION_NAME == 0
+ atexit(elogind_free_program_name);
+-#endif // libc does not provide these variables
}
++#else
++void elogind_set_program_name(const char* pcall) {
++ assert(pcall && pcall[0]);
++}
++#endif // libc does not provide program_invocation_[short_]name
---- a/src/basic/process-util.c
-+++ b/src/basic/process-util.c
-@@ -10,6 +10,7 @@
- #include <stdio.h>
- #include <stdio_ext.h>
- #include <stdlib.h>
-+#include <libgen.h>
- #include <string.h>
- #include <sys/mman.h>
- #include <sys/mount.h>
-@@ -306,8 +307,12 @@
-
- k = strlen(program_invocation_name);
- strncpy(program_invocation_name, name, k);
-- if (l > k)
-+ if (l > k) {
- truncated = true;
-+ program_invocation_short_name = NULL;
-+ }
-+ else
-+ program_invocation_short_name = program_invocation_name + strlen(dirname(program_invocation_name)) -1;
- }
-
- /* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but