summaryrefslogtreecommitdiff
path: root/usr.bin/vi/ex/ex_cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/vi/ex/ex_cd.c')
-rw-r--r--usr.bin/vi/ex/ex_cd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/vi/ex/ex_cd.c b/usr.bin/vi/ex/ex_cd.c
index 3307c7b6306..1a43cd857e6 100644
--- a/usr.bin/vi/ex/ex_cd.c
+++ b/usr.bin/vi/ex/ex_cd.c
@@ -60,7 +60,7 @@ ex_cd(sp, cmdp)
switch (cmdp->argc) {
case 0:
/* If no argument, change to the user's home directory. */
- if ((dir = getenv("HOME")) == NULL) {
+ if ((dir = getenv("HOME")) == NULL || *dir == '\0') {
if ((pw = getpwuid(getuid())) == NULL ||
pw->pw_dir == NULL || pw->pw_dir[0] == '\0') {
msgq(sp, M_ERR,