diff options
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/patches/Fix_glibc_program_invocation_name_pointer_overlap.diff | 63 |
2 files changed, 28 insertions, 36 deletions
diff --git a/debian/changelog b/debian/changelog index 4bad31e13..d749d8a91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ elogind (239.1-1+debian1~rc2) unstable; urgency=medium + * Update fix for SIGABRT to upstream #92. * Disable Dbus activation by default. * Use shutdown rather than poweroff as the latter is missing on runit systems. * Remove upstream pwx git submodule. Thanks to Ian Jackson. 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 |