aboutsummaryrefslogtreecommitdiff
path: root/sh.dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'sh.dir.c')
-rw-r--r--sh.dir.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sh.dir.c b/sh.dir.c
index ab89855bbd42..ff396f64772a 100644
--- a/sh.dir.c
+++ b/sh.dir.c
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.82 2011/10/16 16:25:05 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.85 2016/04/08 16:10:52 christos Exp $ */
/*
* sh.dir.c: Directory manipulation functions
*/
@@ -33,7 +33,7 @@
#include "sh.h"
#include "ed.h"
-RCSID("$tcsh: sh.dir.c,v 3.82 2011/10/16 16:25:05 christos Exp $")
+RCSID("$tcsh: sh.dir.c,v 3.85 2016/04/08 16:10:52 christos Exp $")
/*
* C Shell - directory management
@@ -501,7 +501,9 @@ dochngd(Char **v, struct command *c)
cp = (dflag & DIR_OLD) ? varval(STRowd) : *v;
if (cp == NULL) {
- if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
+ if (!cdtohome)
+ stderror(ERR_NAME | ERR_TOOFEW);
+ else if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
stderror(ERR_NAME | ERR_NOHOMEDIR);
if (chdir(short2str(cp)) < 0)
stderror(ERR_NAME | ERR_CANTCHANGE);
@@ -674,6 +676,7 @@ dfollow(Char *cp, int old)
cleanup_until(cp);
return dgoto(cp);
}
+ xfree(dp);
}
xfree(buf.s);
}