Revision: 45932
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45932&view=rev
Author:   starseeker
Date:     2011-08-11 22:45:43 +0000 (Thu, 11 Aug 2011)

Log Message:
-----------
avoid overwriting the full argv0 path - bu_getprogname was storing its basename 
in the save variable as argv0's full path information.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/progname.c

Modified: brlcad/trunk/src/libbu/progname.c
===================================================================
--- brlcad/trunk/src/libbu/progname.c   2011-08-11 22:10:29 UTC (rev 45931)
+++ brlcad/trunk/src/libbu/progname.c   2011-08-11 22:45:43 UTC (rev 45932)
@@ -31,6 +31,7 @@
 #include "bu.h"
 
 /* internal storage for bu_getprogname/bu_setprogname */
+static char bu_argv0_buffer[MAXPATHLEN] = {0};
 static char bu_progname[MAXPATHLEN] = {0};
 
 
@@ -112,8 +113,8 @@
     /* FIXME: this is temporary until bu_getcwd() is working. */
     (void)_bu_ipwd();
 
-    if (bu_progname[0] != '\0') {
-       argv0 = bu_progname;
+    if (bu_argv0_buffer[0] != '\0') {
+       argv0 = bu_argv0_buffer;
     }
 
 #ifdef HAVE_GETPROGNAME
@@ -206,6 +207,8 @@
 
     if (argv0) {
        snprintf(bu_progname, MAXPATHLEN, "%s", argv0);
+       if (strlen(bu_argv0_buffer) == 0)
+           snprintf(bu_argv0_buffer, MAXPATHLEN, "%s", argv0);
     } else {
        bu_progname[0] = '\0';
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to