Browse Source

don't try to create already existing boxes

if the SELECT command fails even though the box was LISTed, then the
error cause is obviously not that box is absent, and so we should not
attempt to CREATE it.
master
Oswald Buddenhagen 2 years ago
parent
commit
84194a7a9f
  1. 13
      src/sync.c

13
src/sync.c

@ -377,10 +377,13 @@ sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_c
sync_ref( svars );
for (t = 0; ; t++) {
info( "Opening %s box %s...\n", str_fn[t], svars->orig_name[t] );
if (present[t] == BOX_ABSENT)
if (present[t] == BOX_ABSENT) {
box_confirmed2( svars, t );
else
} else {
if (present[t] == BOX_PRESENT)
svars->state[t] |= ST_PRESENT;
svars->drv[t]->open_box( ctx[t], box_confirmed, AUX );
}
if (t || check_cancel( svars ))
break;
}
@ -399,6 +402,12 @@ box_confirmed( int sts, uint uidvalidity, void *aux )
if (sts == DRV_OK) {
svars->state[t] |= ST_PRESENT;
svars->newuidval[t] = uidvalidity;
} else if (svars->state[t] & ST_PRESENT) {
error( "Error: channel %s: %s box %s cannot be opened.\n",
svars->chan->name, str_fn[t], svars->orig_name[t] );
svars->ret |= SYNC_FAIL;
cancel_sync( svars );
return;
}
box_confirmed2( svars, t );
}

Loading…
Cancel
Save