]> skyeroc.xyz Git - dgamelaunch/commitdiff
use a copy of the environment variable instead of the actual spot on the heap
authorJoshua Kwan <joshk@triplehelix.org>
Sun, 12 Sep 2004 08:58:32 +0000 (08:58 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Sun, 12 Sep 2004 08:58:32 +0000 (08:58 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@338 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 44ed1342041508a0dd531a4a2e7982721503e687..ab4bf36a740d3ad30da9cabc746292681e11b6da 100644 (file)
@@ -1670,7 +1670,7 @@ int
 main (int argc, char** argv)
 {
   /* for chroot and program execution */
-  char atrcfilename[81], *spool, *auth = getenv("USER");
+  char atrcfilename[81], *spool, *p, *auth = NULL;
   unsigned int len;
   int c;
   int nhext = 0, nhauth = 0;
@@ -1691,6 +1691,12 @@ main (int argc, char** argv)
   argv = saved_argv;
 #endif
 
+  p = getenv("USER");
+
+  if (p && *p != '\0')
+    auth = strdup(p);
+  /* else auth is still NULL */
+
   __progname = basename(strdup(argv[0]));
 
   while ((c = getopt(argc, argv, "qh:pf:ae")) != -1)