summaryrefslogtreecommitdiff
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2002-03-04 20:15:56 +0000
committerEli Zaretskii <eliz@gnu.org>2002-03-04 20:15:56 +0000
commit48178f9aaf034697cbb2122a9aa28263813f88a4 (patch)
tree3b720c3ce45af7d05e9201a404d167ad2df9a8c7 /src/sysdep.c
parentc0917202cfe848f747188f0b2cebfe04fcce6aa3 (diff)
downloademacs-48178f9aaf034697cbb2122a9aa28263813f88a4.tar.gz
(sys_subshell): Fix last change.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index ef5000eeb09..f79311f837b 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -851,19 +851,20 @@ sys_subshell ()
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
{
- char *old_pwd = getenv ("PWD");
+ char *epwd = getenv ("PWD");
+ char old_pwd[MAXPATHLEN+1+4];
/* If PWD is set, pass it with corrected value. */
- if (old_pwd)
+ if (epwd)
{
- old_pwd = xstrdup (old_pwd);
+ strcpy (old_pwd, epwd);
if (str[len - 1] == '/')
str[len - 1] = '\0';
setenv ("PWD", str, 1);
}
st = system (sh);
chdir (oldwd);
- if (old_pwd)
+ if (epwd)
putenv (old_pwd); /* restore previous value */
}
#if 0 /* This is also reported if last command executed in subshell failed, KFS */