isync

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

commit 343f16771aa9fa1f9c6e793dab84753aa8844052
parent 28cccf4b351b00e5804ed1876d1f01c0cf4e501d
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat, 25 Aug 2012 15:34:26 +0200

don't crash when select() on master fails synchronously

svars->drv[S] would not be initialized yet, so cancel_sync() would
crash.

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

diff --git a/src/sync.c b/src/sync.c @@ -611,6 +611,10 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan, ctx[t]->uidvalidity = -1; set_bad_callback( ctx[t], store_bad, AUX ); svars->drv[t] = ctx[t]->conf->driver; + } + /* Both boxes must be fully set up at this point, so that error exit paths + * don't run into uninitialized variables. */ + for (t = 0; t < 2; t++) { info( "Selecting %s %s...\n", str_ms[t], ctx[t]->name ); DRIVER_CALL(select( ctx[t], (chan->ops[t] & OP_CREATE) != 0, box_selected, AUX )); }