IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 12, 2009, 4:38:34 PM (16 years ago)
Author:
Paul Price
Message:

Fix SEGV from doing cleanup in wrong place. Moved deletion of temporary files to ppStackFinish().

File:
1 edited

Legend:

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

    r25847 r26117  
    44
    55#include <stdio.h>
     6#include <unistd.h>
    67#include <pslib.h>
    78#include <psmodules.h>
     
    2021    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
    2122    psAssert(recipe, "We've thrown an error on this before.");
     23
     24    bool mdok;                          // Status of MD lookup
     25    bool tempDelete = psMetadataLookupBool(&mdok, recipe, "TEMP.DELETE"); // Delete temporary files?
     26
     27    // Delete temporary images
     28    if (tempDelete && options->convolve) {
     29        for (int i = 0; i < options->num; i++) {
     30            if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
     31                continue;
     32            }
     33
     34            psString imageResolved = pmConfigConvertFilename(options->convImages->data[i],
     35                                                             config, false, false);
     36            psString maskResolved = pmConfigConvertFilename(options->convMasks->data[i],
     37                                                            config, false, false);
     38            psString varianceResolved = pmConfigConvertFilename(options->convVariances->data[i],
     39                                                                config, false, false);
     40            if (unlink(imageResolved) == -1 || unlink(maskResolved) == -1 ||
     41                unlink(varianceResolved) == -1) {
     42                psWarning("Unable to delete temporary files for image %d", i);
     43            }
     44            psFree(imageResolved);
     45            psFree(maskResolved);
     46            psFree(varianceResolved);
     47        }
     48    }
     49
    2250
    2351    // Statistics on output
     
    4472    }
    4573
    46 
    4774    // Write out summary statistics
    4875    if (options->stats) {
     
    6188    }
    6289
    63 
    6490    // Dump configuration
    65     bool mdok;                          // Status of MD lookup
    6691    psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
    6792    if (dump) {
Note: See TracChangeset for help on using the changeset viewer.