IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27059


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

More careful error checking on writing statistics file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackFinish.c

    r26898 r27059  
    7979        const char *statsMDC = psMetadataConfigFormat(options->stats);
    8080        if (!statsMDC || strlen(statsMDC) == 0) {
    81             psError(PS_ERR_IO, false, "Unable to get statistics MDC file.\n");
    82         } else {
    83             fprintf(options->statsFile, "%s", statsMDC);
     81            psError(PS_ERR_IO, false, "Unable to get statistics MDC file.");
     82            return false;
     83        }
     84        if (fprintf(options->statsFile, "%s", statsMDC) != strlen(statsMDC)) {
     85            psError(PS_ERR_IO, false, "Unable to write statistics MDC file.");
     86            return false;
    8487        }
    8588        psFree(statsMDC);
    86         fclose(options->statsFile); options->statsFile = NULL;
     89        if (fclose(options->statsFile) == EOF) {
     90            psError(PS_ERR_IO, false, "Unable to close statistics MDC file.");
     91            return false;
     92        }
     93        options->statsFile = NULL;
    8794        pmConfigRunFilenameAddWrite(config, "STATS", psMetadataLookupStr(NULL, config->arguments, "STATS"));
    8895    }
     
    9299    if (dump) {
    93100        if (!pmConfigDump(config, dump)) {
    94             psError(PS_ERR_IO, false, "Unable to dump configuration.");
     101            psError(psErrorCodeLast(), false, "Unable to dump configuration.");
    95102            return false;
    96103        }
Note: See TracChangeset for help on using the changeset viewer.