summaryrefslogtreecommitdiff
path: root/bin/ksh/mail.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-25 19:02:48 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-25 19:02:48 +0000
commitf7502f1aee86c9a3ebb4d6814e47a52727bc2d42 (patch)
tree0bd2bbab7d507d7dab286df7970c0101a3cb1807 /bin/ksh/mail.c
parentcc7df4d09ccd66ffca19799a357c049e1b5bf030 (diff)
pdksh-5.2.13 + local changes
Diffstat (limited to 'bin/ksh/mail.c')
-rw-r--r--bin/ksh/mail.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c
index 79ff7aee0f6..d3136632622 100644
--- a/bin/ksh/mail.c
+++ b/bin/ksh/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.6 1997/11/16 12:07:28 niklas Exp $ */
+/* $OpenBSD: mail.c,v 1.7 1998/06/25 19:02:09 millert Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -92,9 +92,12 @@ mbset(p)
if (mbox.mb_msg)
afree((void *)mbox.mb_msg, APERM);
- mbox.mb_path = p;
+ if (mbox.mb_path)
+ afree((void *)mbox.mb_path, APERM);
+ /* Save a copy to protect from export (which munges the string) */
+ mbox.mb_path = str_save(p, APERM);
mbox.mb_msg = NULL;
- if (p && stat(p,&stbuf) == 0 && S_ISREG(stbuf.st_mode))
+ if (p && stat(p, &stbuf) == 0 && S_ISREG(stbuf.st_mode))
mbox.mb_mtime = stbuf.st_mtime;
else
mbox.mb_mtime = 0;