Commit 9a3839df 9a3839dff7466bb737809e6795bd649617431c0d by Alain Magloire

* mailbox/header.c : ENOENT was not return if the header was

not found.
* mailbox/mbx_mbox.c: When expunging check to see if the registar
the path_record too.
1 parent d0524fd6
......@@ -472,12 +472,7 @@ header_get_value (header_t header, const char *name, char *buffer,
if (pn)
*pn = total;
if (total == 0)
{
err = ENOENT;
}
return err;
return (total == 0) ? ENOENT : 0;
}
int
......
......@@ -559,20 +559,35 @@ mbox_expunge (mailbox_t mailbox)
}
else
{
/* strlen ("mbox:") == 5 + strlen (tmpmboxname) + 1 */
char *m = alloca (5 + strlen (tmpmboxname) + 1);
/* Try via the mbox: protocol. */
sprintf (m, "mbox:%s", tmpmboxname);
/* Must put create if not the open will try to mmap() the file. */
if ((status = mailbox_create (&tmpmailbox, m)) != 0
|| (status
= mailbox_open (tmpmailbox, MU_STREAM_CREAT | MU_STREAM_RDWR)) != 0)
status = mailbox_create (&tmpmailbox, m);
if (status != 0)
{
/* Do not give up just yet, maybe they register the path_record. */
sprintf (m, "%s", tmpmboxname);
status = mailbox_create (&tmpmailbox, m);
if (status != 0)
{
/* Ok give up. */
close (tempfile);
remove (tmpmboxname);
free (tmpmboxname);
return status;
}
}
/* Must be flag create if not the open will try to mmap() the file. */
status = mailbox_open (tmpmailbox, MU_STREAM_CREAT | MU_STREAM_RDWR);
if (status != 0)
{
close (tempfile);
remove (tmpmboxname);
free (tmpmboxname);
return status;
}
close (tempfile);
close (tempfile); /* This one is useless the mailbox have its own. */
}
/* Get the File lock. */
......