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.
This commit is contained in:
Oswald Buddenhagen
2023-01-10 11:37:26 +01:00
parent ceb0fa9803
commit 84194a7a9f

View File

@@ -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 );
}