From 1ab7d0fd0b21514a243db0b602d883acb3372a05 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 30 Jul 2007 20:46:04 +0000 Subject: 23725: use setenv()/unsetenv() for environment memory management --- Src/exec.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index ad088001e..baabf1b87 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -524,7 +524,16 @@ execute(LinkList args, int flags, int defpath) * that as argv[0] for this external command */ if (unset(RESTRICTED) && (z = zgetenv("ARGV0"))) { setdata(firstnode(args), (void *) ztrdup(z)); + /* + * Note we don't do anything with the parameter structure + * for ARGV0: that's OK since we're about to exec or exit + * on failure. + */ +#ifdef HAVE_UNSETENV + unsetenv("ARGV0"); +#else delenvvalue(z - 6); +#endif } else if (flags & BINF_DASH) { /* Else if the pre-command `-' was given, we add `-' * * to the front of argv[0] for this command. */ -- cgit 1.4.1