From: Joshua Kwan Date: Sun, 12 Sep 2004 08:58:32 +0000 (+0000) Subject: use a copy of the environment variable instead of the actual spot on the heap X-Git-Tag: v1.6.1-roc-dev~367 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=7e976aa77074d3dd3867f31b681eb4a734bda2de;p=dgamelaunch use a copy of the environment variable instead of the actual spot on the heap git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@338 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/dgamelaunch.c b/dgamelaunch.c index 44ed134..ab4bf36 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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)