summaryrefslogtreecommitdiffabout
path: root/mail/cd.c
Side-by-side diff
Diffstat (limited to 'mail/cd.c') (more/less context) (ignore whitespace changes)
-rw-r--r--mail/cd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/mail/cd.c b/mail/cd.c
index cb71b4c..122a1af 100644
--- a/mail/cd.c
+++ b/mail/cd.c
@@ -24,7 +24,8 @@
int
mail_cd (int argc, char **argv)
{
- char *dir;
+ char *dir, *edir;
+ int rc;
if (argc > 2)
return 1;
@@ -33,10 +34,16 @@ mail_cd (int argc, char **argv)
else
dir = getenv ("HOME");
- if (chdir (dir))
+ rc = mu_mailbox_expand_name (dir, &edir);
+ if (rc)
{
- mu_diag_funcall (MU_DIAG_ERROR, "chdir", dir, errno);
+ mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_expand_name", dir, rc);
return 1;
}
- return 0;
+
+ rc = chdir (edir);
+ if (rc)
+ mu_diag_funcall (MU_DIAG_ERROR, "chdir", edir, errno);
+ free (edir);
+ return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.