IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36946


Ignore:
Timestamp:
Jun 30, 2014, 9:40:40 PM (12 years ago)
Author:
eugene
Message:

handle lock / unlink for catalogs without all entries (eg, missing the lensing, lensobj tables)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dvo_catalog.c

    r36921 r36946  
    533533  }
    534534
     535  // closes f but does not set back to NULL
    535536  fclearlockfile (catalog[0].filename, catalog[0].f, catalog[0].lockmode, &dbstate);
    536537
     
    944945    }
    945946    if (catalog[0].lensing_catalog != NULL) {
    946       if (!dvo_catalog_backup (catalog[0].lensing_catalog, FALSE)) {
    947         return FALSE;
     947      if (catalog[0].Nlensing_disk == 0) {
     948        // need to relock (and re-open) file for close elsewhere
     949        status = dvo_catalog_lock (catalog[0].lensing_catalog, lockmode);
     950      } else {
     951        if (!dvo_catalog_backup (catalog[0].lensing_catalog, FALSE)) {
     952          return FALSE;
     953        }
    948954      }
    949955    }
    950956    if (catalog[0].lensobj_catalog != NULL) {
    951       if (!dvo_catalog_backup (catalog[0].lensobj_catalog, FALSE)) {
    952         return FALSE;
     957      if (catalog[0].Nlensobj_disk == 0) {
     958        // need to relock (and re-open) file for close elsewhere
     959        status = dvo_catalog_lock (catalog[0].lensobj_catalog, lockmode);
     960      } else {
     961        if (!dvo_catalog_backup (catalog[0].lensobj_catalog, FALSE)) {
     962          return FALSE;
     963        }
    953964      }
    954965    }
     
    974985  status = unlink (tmpfilename);
    975986  if (status) {
    976     fprintf (stderr, "failed to unlink catalog %s\n", catalog->filename);
     987    fprintf (stderr, "failed to unlink catalog %s~\n", catalog->filename);
    977988    return FALSE;
    978989  }
     
    9941005      }
    9951006    }
    996     if (catalog[0].lensing_catalog != NULL) {
     1007    if ((catalog[0].lensing_catalog != NULL) && (catalog[0].Nlensing_disk > 0)) {
    9971008      if (!dvo_catalog_unlink_backup (catalog[0].lensing_catalog, FALSE)) {
    9981009        return FALSE;
    9991010      }
    10001011    }
    1001     if (catalog[0].lensobj_catalog != NULL) {
     1012    if ((catalog[0].lensobj_catalog != NULL) && (catalog[0].Nlensobj_disk > 0)) {
    10021013      if (!dvo_catalog_unlink_backup (catalog[0].lensobj_catalog, FALSE)) {
    10031014        return FALSE;
Note: See TracChangeset for help on using the changeset viewer.