IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11859


Ignore:
Timestamp:
Feb 16, 2007, 12:25:44 PM (19 years ago)
Author:
jhoblitt
Message:

properly handle pzgetimfileConfig() errors

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pzgetimfiles.c

    r10971 r11859  
    4040
    4141    pxConfig *config = pzgetimfilesConfig(NULL, argc, argv);
     42    if (!config) {
     43        psError(PXTOOLS_ERR_CONFIG, false, "failed to configure");
     44        goto FAIL;
     45    }
    4246
    4347    if (!go(config)) {
     
    5357FAIL:
    5458    psErrorStackPrint(stderr, "\n");
     59    int exit_status = pxerrorGetExitStatus();
    5560
    5661    psFree(config);
     
    5863    psLibFinalize();
    5964
    60     exit(EXIT_FAILURE);
     65    exit(exit_status);
    6166}
    6267
  • trunk/ippTools/src/pzgetimfilesConfig.c

    r11089 r11859  
    2929#include "pxtools.h"
    3030
    31 pxConfig *pzgetimfilesConfig(pxConfig *config, int argc, char **argv) {
     31pxConfig *pzgetimfilesConfig(pxConfig *config, int argc, char **argv)
     32{
    3233    if (!config) {
    3334        config = pxConfigAlloc();
     
    3940    if (! config->modules) {
    4041        psError(PS_ERR_UNKNOWN, false, "Can't find site configuration!\n");
    41         goto FAIL;
     42        psFree(config);
     43        return NULL;
    4244    }
    4345
     
    6466        psArgumentHelp(args);
    6567        psFree(args);
    66         goto FAIL;
     68        psFree(config);
     69        return NULL;
    6770    }
    6871
     
    7578    if(!config->dbh) {
    7679        psError(PS_ERR_UNKNOWN, false, "Can't connect to db\n");
    77         goto FAIL;
     80        psFree(config);
     81        return NULL;
    7882    }
    7983
    8084    return config;
    81 
    82 FAIL:
    83     psFree(config);
    84     pmConfigDone();
    85     psLibFinalize();
    86     exit(EXIT_FAILURE);
    8785}
Note: See TracChangeset for help on using the changeset viewer.