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, ...@@ -472,12 +472,7 @@ header_get_value (header_t header, const char *name, char *buffer,
472 if (pn) 472 if (pn)
473 *pn = total; 473 *pn = total;
474 474
475 if (total == 0) 475 return (total == 0) ? ENOENT : 0;
476 {
477 err = ENOENT;
478 }
479
480 return err;
481 } 476 }
482 477
483 int 478 int
......
...@@ -559,20 +559,35 @@ mbox_expunge (mailbox_t mailbox) ...@@ -559,20 +559,35 @@ mbox_expunge (mailbox_t mailbox)
559 } 559 }
560 else 560 else
561 { 561 {
562 /* strlen ("mbox:") == 5 + strlen (tmpmboxname) + 1 */
563 char *m = alloca (5 + strlen (tmpmboxname) + 1); 562 char *m = alloca (5 + strlen (tmpmboxname) + 1);
563 /* Try via the mbox: protocol. */
564 sprintf (m, "mbox:%s", tmpmboxname); 564 sprintf (m, "mbox:%s", tmpmboxname);
565 /* Must put create if not the open will try to mmap() the file. */ 565 status = mailbox_create (&tmpmailbox, m);
566 if ((status = mailbox_create (&tmpmailbox, m)) != 0 566 if (status != 0)
567 || (status 567 {
568 = mailbox_open (tmpmailbox, MU_STREAM_CREAT | MU_STREAM_RDWR)) != 0) 568 /* Do not give up just yet, maybe they register the path_record. */
569 sprintf (m, "%s", tmpmboxname);
570 status = mailbox_create (&tmpmailbox, m);
571 if (status != 0)
572 {
573 /* Ok give up. */
574 close (tempfile);
575 remove (tmpmboxname);
576 free (tmpmboxname);
577 return status;
578 }
579 }
580
581 /* Must be flag create if not the open will try to mmap() the file. */
582 status = mailbox_open (tmpmailbox, MU_STREAM_CREAT | MU_STREAM_RDWR);
583 if (status != 0)
569 { 584 {
570 close (tempfile); 585 close (tempfile);
571 remove (tmpmboxname); 586 remove (tmpmboxname);
572 free (tmpmboxname); 587 free (tmpmboxname);
573 return status; 588 return status;
574 } 589 }
575 close (tempfile); 590 close (tempfile); /* This one is useless the mailbox have its own. */
576 } 591 }
577 592
578 /* Get the File lock. */ 593 /* Get the File lock. */
......