about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-07-30 20:46:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-07-30 20:46:04 +0000
commit1ab7d0fd0b21514a243db0b602d883acb3372a05 (patch)
tree6ff962b4d11c425d2512e1170579983c978e7ef2 /Src/exec.c
parent378c2c7ae7d5c98c856ab60978736f38a168151b (diff)
downloadzsh-1ab7d0fd0b21514a243db0b602d883acb3372a05.tar.gz
zsh-1ab7d0fd0b21514a243db0b602d883acb3372a05.tar.xz
zsh-1ab7d0fd0b21514a243db0b602d883acb3372a05.zip
23725: use setenv()/unsetenv() for environment memory management
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c9
1 files changed, 9 insertions, 0 deletions
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.         */