IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 2, 2006, 3:02:08 PM (20 years ago)
Author:
Paul Price
Message:

Applying RHL patch. Generally improves the error handling and traceback. pmConcepts.c and pmConceptsRead.c done by PAP (RHL did this also, but I had already done them). Resolved conflicts, except for pmFPAfile.c, which uses psAbort in some instances where RHL's patch had psError; leave this for Gene to decide.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_CMP.c

    r7306 r7311  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-06-03 00:40:46 $
     5 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-06-03 01:02:08 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6969
    7070    psFits *fits = psFitsOpen (filename, "w");
    71     psFitsWriteBlank(fits, header);
    72     psFitsClose (fits);
     71    if (fits == NULL) {
     72        psError(PS_ERR_IO, false, "can't open output file for write %s\n", filename);
     73        return false;
     74    }
     75    if (!psFitsWriteBlank(fits, header)) {
     76        psError(PS_ERR_IO, false, "Writing header to %s\n", filename);
     77        (void)psFitsClose(fits);
     78        return false;
     79    }
     80    if (!psFitsClose(fits)) {
     81        const psErrorCode code = psErrorCodeLast();
     82
     83        if (code == PS_ERR_BAD_FITS) {
     84            psErrorClear();
     85        } else {
     86            psError(PS_ERR_IO, false, "Closing %s\n", filename);
     87            return false;
     88        }
     89    }
    7390
    7491    // re-open, add data to end of file
    7592    FILE *f = fopen (filename, "a+");
    7693    if (f == NULL) {
    77         psLogMsg ("WriteSourceOBJ", 3, "can't open output file for output %s\n", filename);
     94        psLogMsg ("WriteSourceOBJ", 3, "can't reopen output file for append %s\n", filename);
     95        psError(PS_ERR_IO, false, "can't open output file for output %s\n", filename);
    7896        return false;
    7997    }
Note: See TracChangeset for help on using the changeset viewer.