From: Pádraig Brady
Date: Sun, 12 Jan 2025 16:47:57 +0000 (+0000)
Subject: progname: also set program_invocation_short_name
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6252c111bafc4b781637c621740af5b854c0436a;p=gnulib.git
progname: also set program_invocation_short_name
* lib/progname.c (set_program_name): Keep program_invocation_name
and program_invocation_short_name consistent.
---
diff --git a/ChangeLog b/ChangeLog
index a7f4b4ec29..eefb49a616 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-01-12 Pádraig Brady
+
+ progname: also set program_invocation_short_name
+ * lib/progname.c (set_program_name): Keep program_invocation_name
+ and program_invocation_short_name consistent.
+
2025-01-11 Bruno Haible
eealloc, malloca: Fix module dependencies.
diff --git a/lib/progname.c b/lib/progname.c
index db17f5b208..4a45ca3490 100644
--- a/lib/progname.c
+++ b/lib/progname.c
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2001-2003, 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2025 Free Software Foundation, Inc.
Written by Bruno Haible , 2001.
This program is free software: you can redistribute it and/or modify
@@ -63,12 +63,8 @@ set_program_name (const char *argv0)
argv0 = base;
if (strncmp (base, "lt-", 3) == 0)
{
- argv0 = base + 3;
- /* On glibc systems, remove the "lt-" prefix from the variable
- program_invocation_short_name. */
-#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
- program_invocation_short_name = (char *) argv0;
-#endif
+ base += 3;
+ argv0 = base;
}
}
@@ -89,4 +85,7 @@ set_program_name (const char *argv0)
#if HAVE_DECL_PROGRAM_INVOCATION_NAME
program_invocation_name = (char *) argv0;
#endif
+#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+ program_invocation_short_name = (char *) base;
+#endif
}