Navigation


Changeset 1412:4768e3bf1c9b in freeDiameter for freeDiameterd


Ignore:
Timestamp:
Feb 18, 2020, 3:21:20 PM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
committer:
Luke Mewburn <luke@mewburn.net> 1582007266 -39600
Message:

freeDiameter: use standard exit codes

Exit with EXIT_FAILURE (1) on any error,
and EXIT_SUCCESS (0) if ok

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameterd/main.c

    r1411 r1412  
    155155        ret = main_cmdline(argc, argv);
    156156        if (ret != 0) {
    157                 return ret;
     157                return EXIT_FAILURE;
    158158        }
    159159
    160160        if (daemon_mode) {
    161161                TRACE_DEBUG(INFO, "entering background mode");
    162                 CHECK_SYS( daemon(1, 0) );
    163         }
    164 
    165         CHECK_FCT( pidfile_create() );
     162                CHECK_SYS_DO( daemon(1, 0), return EXIT_FAILURE );
     163        }
     164
     165        CHECK_FCT_DO( pidfile_create(), return EXIT_FAILURE );
    166166
    167167        /* Initialize the core library */
     
    169169        if (ret != 0) {
    170170                fprintf(stderr, "An error occurred during freeDiameter core library initialization.\n");
    171                 return ret;
     171                return EXIT_FAILURE;
    172172        }
    173173
     
    191191
    192192        /* Now, just wait for termination */
    193         CHECK_FCT( fd_core_wait_shutdown_complete() );
     193        CHECK_FCT_DO( fd_core_wait_shutdown_complete(), return EXIT_FAILURE );
    194194
    195195        /* Just in case it was not the result of a signal, we cancel signals_thr */
    196196        fd_thr_term(&signals_thr);
    197197
    198         return 0;
     198        return EXIT_SUCCESS;
    199199error:
    200200        CHECK_FCT_DO( fd_core_shutdown(),  );
    201         CHECK_FCT( fd_core_wait_shutdown_complete() );
     201        CHECK_FCT_DO( fd_core_wait_shutdown_complete(), return EXIT_FAILURE );
    202202        fd_thr_term(&signals_thr);
    203         return -1;
     203        return EXIT_FAILURE;
    204204}
    205205
     
    277277                        case 'h':       /* Print help and exit.  */
    278278                                main_help();
    279                                 exit(0);
     279                                exit(EXIT_SUCCESS);
    280280
    281281                        case 'V':       /* Print version and exit.  */
    282282                                main_version();
    283                                 exit(0);
     283                                exit(EXIT_SUCCESS);
    284284
    285285                        case 'c':       /* Read configuration from this file instead of the default location..  */
Note: See TracChangeset for help on using the changeset viewer.