isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 49223b2df217f4c5db24126b00f82a623f0f91f7
parent a326bf2f5890230fb31b982e39be9b80ad4fdecf
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat, 15 Sep 2012 14:38:39 +0200

avoid that a system crash can cause messages to be propagated twice

fdatasync() the journal after creating the pair record and recording
the TUID, but before the message propagation actually starts.

all other writes to the journal are not flushed, as they will at worst
cause some unnecessary network traffic without visible effect.

Diffstat:
Msrc/sync.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/sync.c b/src/sync.c @@ -1202,6 +1202,7 @@ box_loaded( int sts, void *aux ) cv->srec = srec; cv->msg = tmsg; Fprintf( svars->jfp, "# %d %d %." stringify(TUIDL) "s\n", srec->uid[M], srec->uid[S], srec->tuid ); + fdatasync( fileno( svars->jfp ) ); debug( " -> %sing message, TUID %." stringify(TUIDL) "s\n", str_hl[t], srec->tuid ); if (copy_msg( cv )) return;