aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-10 18:53:44 +0000
committermarha <marha@users.sourceforge.net>2011-04-10 18:53:44 +0000
commit57fb3f76b66c5f7a9f7bed9c42fb9fec9d56ee05 (patch)
tree62c44b8772f885ab8252004587bcf01b1c2741ba /mesalib/src/mesa/drivers/dri/common/xmlconfig.c
parent5deaba2736a906e599eb03f2883fba036150c662 (diff)
parent2fb58f16eeec8ef3ec2a25e246477aab64e38a7d (diff)
downloadvcxsrv-57fb3f76b66c5f7a9f7bed9c42fb9fec9d56ee05.tar.gz
vcxsrv-57fb3f76b66c5f7a9f7bed9c42fb9fec9d56ee05.tar.bz2
vcxsrv-57fb3f76b66c5f7a9f7bed9c42fb9fec9d56ee05.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common/xmlconfig.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index eaba335a4..30075f253 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -64,7 +64,25 @@ extern char *program_invocation_name, *program_invocation_short_name;
the basename to match BSD getprogname() */
# include <stdlib.h>
# include <libgen.h>
-# define GET_PROGRAM_NAME() basename(getexecname())
+
+static const char *__getProgramName () {
+ static const char *progname;
+
+ if (progname == NULL) {
+ const char *e = getexecname();
+ if (e != NULL) {
+ /* Have to make a copy since getexecname can return a readonly
+ string, but basename expects to be able to modify its arg. */
+ char *n = strdup(e);
+ if (n != NULL) {
+ progname = basename(n);
+ }
+ }
+ }
+ return progname;
+}
+
+# define GET_PROGRAM_NAME() __getProgramName()
#endif
#if !defined(GET_PROGRAM_NAME)