IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27063


Ignore:
Timestamp:
Feb 24, 2010, 2:47:30 PM (16 years ago)
Author:
Paul Price
Message:

Be more careful about writing the statistics file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r27048 r27063  
    510510        const char *statsMDC = psMetadataConfigFormat(stats);
    511511        if (!statsMDC) {
    512             psError(PS_ERR_IO, false, "Unable to get statistics MDC file.\n");
     512            psError(psErrorCodeLast(), false, "Unable to get statistics file.");
    513513            psFree(stats);
    514514            fclose(statsFile);
    515515            return false;
    516516        }
    517         fprintf(statsFile, "%s", statsMDC);
     517        psFree(stats);
     518        if (fprintf(statsFile, "%s", statsMDC) != strlen(statsMDC)) {
     519            psError(PSWARP_ERR_IO, true, "Unable to write statistics file.");
     520            psFree(statsMDC);
     521            return false;
     522        }
    518523        psFree(statsMDC);
    519         fclose(statsFile);
     524        if (fclose(statsFile) == EOF) {
     525            psError(PSWARP_ERR_IO, true, "Unable to close statistics file.");
     526            return false;
     527        }
    520528        pmConfigRunFilenameAddWrite(config, "STATS", statsName);
    521 
    522         psFree(stats);
    523529    }
    524530
     
    527533    if (dump_file) {
    528534        if (!pmConfigDump(config, dump_file)) {
    529             psError(PS_ERR_IO, false, "Unable to dump configuration");
     535            psError(psErrorCodeLast(), false, "Unable to dump configuration");
    530536            return false;
    531537        }
Note: See TracChangeset for help on using the changeset viewer.