Mercurial > hg > octave-kai > gnulib-hg
changeset 11897:341123ec9461
progname: also set global program_invocation_name, when possible.
Before this change, a libtool-enabled program that calls glibc's
error function would report the program name as
"/abs/dir/.libs/lt-program_name" rather than the desired program_name.
* modules/progname (configure.ac): Check for a declaration of
program_invocation_name.
* lib/progname.c: Include <errno.h>.
(set_program_name) [HAVE_DECL_PROGRAM_INVOCATION_NAME]:
Set program_invocation_name.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Tue, 25 Aug 2009 01:02:32 +0200 |
parents | 5982a4bdef97 |
children | 90fb3f330caf |
files | ChangeLog lib/progname.c modules/progname |
diffstat | 3 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-08-24 Jim Meyering <meyering@redhat.com> + + progname: also set global program_invocation_name, when possible + Before this change, a libtool-enabled program that calls glibc's + error function would report the program name as + "/abs/dir/.libs/lt-program_name" rather than the desired program_name. + * modules/progname (configure.ac): Check for a declaration of + program_invocation_name. + * lib/progname.c: Include <errno.h>. + (set_program_name) [HAVE_DECL_PROGRAM_INVOCATION_NAME]: + Set program_invocation_name. + 2009-08-23 Bruno Haible <bruno@clisp.org> * lib/dup3.c: Include <string.h>.
--- a/lib/progname.c +++ b/lib/progname.c @@ -22,6 +22,7 @@ #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ #include "progname.h" +#include <errno.h> /* get program_invocation_name declaration */ #include <string.h> @@ -60,4 +61,11 @@ */ program_name = argv0; + + /* On glibc systems, when the gnulib module 'error' is not used, the error() + function comes from libc and uses the variable program_invocation_name, + not program_name. So set this variable as well. */ +#if HAVE_DECL_PROGRAM_INVOCATION_NAME + program_invocation_name = (char *) argv0; +#endif }