IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27108


Ignore:
Timestamp:
Feb 26, 2010, 3:17:54 PM (16 years ago)
Author:
Paul Price
Message:

Bit more elegant solution.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

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

    r27107 r27108  
    5858    // Common code for the death.
    5959    {
    60         psExit exitValue = ppStackExitCode(); // Exit code
     60        psExit exitValue = ppStackExitCode(PS_EXIT_SUCCESS); // Exit code
    6161
    6262        // Ensure everything closes
     
    6767            ppStackFileActivation(config, PPSTACK_FILES_PHOT, true);
    6868            if (!ppStackFilesIterateUp(config)) {
    69                 psErrorStackPrint(stderr, "Unable to close files.");
    70                 if (exitValue == PS_EXIT_SUCCESS) {
    71                     exitValue = ppStackExitCode();
    72                 }
     69                psError(psErrorCodeLast(), false, "Unable to close files.");
     70                exitValue = ppStackExitCode(exitValue);
    7371            }
    7472        }
     
    7876        psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
    7977        if (dump && !pmConfigDump(config, dump)) {
    80             psErrorStackPrint(stderr, "Unable to dump configuration.");
    81             if (exitValue == PS_EXIT_SUCCESS) {
    82                 exitValue = ppStackExitCode();
    83             }
     78            psError(psErrorCodeLast(), false, "Unable to dump configuration.");
     79            exitValue = ppStackExitCode(exitValue);
    8480        }
    8581
     
    9389        pmVisualClose();
    9490
     91        exitValue = ppStackExitCode(exitValue);
    9592        exit(exitValue);
    9693    }
  • trunk/ppStack/src/ppStack.h

    r27107 r27108  
    170170
    171171/// Return an appropriate exit code based on the error code
    172 psExit ppStackExitCode(void);
     172psExit ppStackExitCode(psExit exitValue);
    173173
    174174#endif
  • trunk/ppStack/src/ppStackFinish.c

    r27107 r27108  
    9494
    9595
    96 psExit ppStackExitCode(void)
     96psExit ppStackExitCode(psExit exitValue)
    9797{
    98     psExit exitValue = PS_EXIT_SUCCESS;        // Exit code to return
     98    if (exitValue != PS_EXIT_SUCCESS) {
     99        return exitValue;
     100    }
     101
    99102    psErrorCode errorCode = psErrorCodeLast(); // Error code
    100103    if (errorCode != PS_ERR_NONE) {
Note: See TracChangeset for help on using the changeset viewer.