[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sergey(patch mbx_mbox.c)
From: |
Alain Magloire |
Subject: |
Sergey(patch mbx_mbox.c) |
Date: |
Mon, 23 Apr 2001 19:51:38 -0400 (EDT) |
Bonjour
Ok I'm walking through the essentials diff. One thing, I do not
understand your rationale for the patch below.
For the function mbx_is_updated(), which implements the on-disk
mailbox_is_updated(), you proposed two changes:
! if (mud->size == 0 || stream_size (mailbox->stream, &size) != 0)
...
! return (mud->size != size);
It seems you got this backward, the function should return FALSE
if mud->size != size i.e. the size have change so the mailbox is not
updated and will need to be.
I know it's confusing 8-). In other words this function should return
true if the mailbox __is__ updated i.e. when the size that we hold
internally and the current size of the mailbox(file) are the same.
I also feel that, it's not enough and that I should have a timestamp
say, the modification time. Because someone could _delete_ a message
and add a message of the __same__ size to the mailbox. I would not
be able to detect it.
====================
RCS file: /cvs/mailutils/mailbox/mbx_mbox.c,v
retrieving revision 1.43
diff -c -b -w -r1.43 mbx_mbox.c
*** mailbox/mbx_mbox.c 2001/04/17 03:31:19 1.43
--- mailbox/mbx_mbox.c 2001/04/21 15:11:05
***************
*** 475,491 ****
{
off_t size = 0;
mbox_data_t mud = mailbox->data;
! if (stream_size (mailbox->stream, &size) != 0)
return 0;
if (size < mud->size)
{
observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT);
/* And be verbose. ? */
fprintf (stderr, "* BAD : Mailbox corrupted, shrank size\n");
/* FIXME: should I crash. */
return 1;
}
! return (mud->size == size);
}
/* Try to create an uniq file, we no race conditions. */
--- 475,491 ----
{
off_t size = 0;
mbox_data_t mud = mailbox->data;
! if (mud->size == 0 || stream_size (mailbox->stream, &size) != 0)
return 0;
if (size < mud->size)
{
observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT);
/* And be verbose. ? */
fprintf (stderr, "* BAD : Mailbox corrupted, shrank size\n");
/* FIXME: should I crash. */
return 1;
}
! return (mud->size != size);
}
- sieve, and header_t's api, Sam Roberts, 2001/04/22
- Re: sieve, and header_t's api, Alain Magloire, 2001/04/22
- Message not available
- Re: sieve, and header_t's api, Sam Roberts, 2001/04/23
- Re: sieve, and header_t's api, Alain Magloire, 2001/04/23
- Bug in mapfile_stream.c, Sergey Poznyakoff, 2001/04/23
- Sergey(patch mbx_mbox.c),
Alain Magloire <=
- POP3d locking, Alain Magloire, 2001/04/23
- Re: POP3d locking, Sergey Poznyakoff, 2001/04/24
- Re: POP3d locking, Alain Magloire, 2001/04/24
- Re: POP3d locking, Sergey Poznyakoff, 2001/04/24
- Re: POP3d locking, Alain Magloire, 2001/04/24
- Re: POP3d locking, Sergey Poznyakoff, 2001/04/24
- Re: POP3d locking, Alain Magloire, 2001/04/24
- Re: POP3d locking, Sergey Poznyakoff, 2001/04/24
- Re: POP3d locking, Alain Magloire, 2001/04/24
- Re: sieve, and header_t's api, Alain Magloire, 2001/04/24