]> dgit.raspbian.org Git - samba.git/commitdiff
inline getprogname replacement
authorMichael Tokarev <mjt@tls.msk.ru>
Tue, 20 Jan 2026 19:27:54 +0000 (22:27 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 25 Sep 2026 09:44:12 +0000 (12:44 +0300)
Forwarded: not-needed

Inline getprogname() by using program_invocation_short_name
when available (like with glibc).

This makes a lot of binaries to avoid linkage to libreplace.

This is a short and dirty version, proper change for upstream
should clean up #ifdef'fery in replace.c.

Gbp-Pq: Name inline-getprogname.diff

lib/replace/replace.c
lib/replace/replace.h

index 33cbbec14533dd11e81bceaf6a7e5450d1118cab..b0e1edbdf21f091f7b6f33e639e596deedf26e7c 100644 (file)
@@ -1144,7 +1144,7 @@ void *rep_memset_explicit(void *block, int c, size_t size)
 }
 #endif
 
-#ifndef HAVE_GETPROGNAME
+#if !defined(HAVE_GETPROGNAME) && !defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
 # ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
 # define PROGNAME_SIZE 32
 static char rep_progname[PROGNAME_SIZE];
index 24791c26e40cc694695ae57026e0adb957f8a08b..0f514052824b28199b1da7bc8ffae249e71906d4 100644 (file)
@@ -1046,9 +1046,13 @@ void *rep_memset_explicit(void *block, int c, size_t size);
 #endif
 
 #ifndef HAVE_GETPROGNAME
+#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+# define getprogname() (program_invocation_short_name)
+#else
 #define getprogname rep_getprogname
 const char *rep_getprogname(void);
 #endif
+#endif
 
 #ifndef HAVE_COPY_FILE_RANGE
 #define copy_file_range rep_copy_file_range