@@ -726,7 +726,7 @@ static void _add_block(struct block_device *block)
726
726
temp -> sysfs_path = strdup (block -> sysfs_path );
727
727
if (!temp -> sysfs_path ) {
728
728
log_error ("Memory allocation error!" );
729
- exit (1 );
729
+ EXIT (1 );
730
730
}
731
731
}
732
732
} else {
@@ -737,7 +737,7 @@ static void _add_block(struct block_device *block)
737
737
ibpi2str_table (temp -> ibpi , ibpi_str_ledmon , buf , sizeof (buf )));
738
738
if (!list_append (& ledmon_block_list , temp )) {
739
739
log_error ("Memory allocation error!" );
740
- exit (1 );
740
+ EXIT (1 );
741
741
}
742
742
}
743
743
}
@@ -950,47 +950,47 @@ int main(int argc, char *argv[])
950
950
lib_rc = led_new (& ctx );
951
951
if (lib_rc != LED_STATUS_SUCCESS ) {
952
952
fprintf (stderr , "Unable to initialize lib LED %u\n" , lib_rc );
953
- return lib_rc ;
953
+ EXIT ( lib_rc ) ;
954
954
}
955
955
956
956
openlog (progname , LOG_PID | LOG_PERROR , LOG_DAEMON );
957
957
958
958
if (atexit (_ledmon_status ))
959
- return LEDMON_STATUS_ONEXIT_ERROR ;
959
+ EXIT ( LEDMON_STATUS_ONEXIT_ERROR ) ;
960
960
961
961
if (_cmdline_parse_non_daemonize (argc , argv ) != LEDMON_STATUS_SUCCESS )
962
- return LEDMON_STATUS_CMDLINE_ERROR ;
962
+ EXIT ( LEDMON_STATUS_CMDLINE_ERROR ) ;
963
963
964
964
if (geteuid () != 0 ) {
965
965
fprintf (stderr , "Only root can run this application.\n" );
966
- return LEDMON_STATUS_NOT_A_PRIVILEGED_USER ;
966
+ EXIT ( LEDMON_STATUS_NOT_A_PRIVILEGED_USER ) ;
967
967
}
968
968
969
969
status = _init_ledmon_conf ();
970
970
if (status != LEDMON_STATUS_SUCCESS )
971
- return status ;
971
+ EXIT ( status ) ;
972
972
973
973
status = ledmon_read_conf (ledmon_conf_path , & conf );
974
974
if (status != LEDMON_STATUS_SUCCESS )
975
- return status ;
975
+ EXIT ( status ) ;
976
976
977
977
if (_cmdline_parse (argc , argv ) != LEDMON_STATUS_SUCCESS )
978
- return LEDMON_STATUS_CMDLINE_ERROR ;
978
+ EXIT ( LEDMON_STATUS_CMDLINE_ERROR ) ;
979
979
980
980
ledmon_write_shared_conf (& conf );
981
981
982
982
if (log_open (& conf ) != LEDMON_STATUS_SUCCESS )
983
- return LEDMON_STATUS_LOG_FILE_ERROR ;
983
+ EXIT ( LEDMON_STATUS_LOG_FILE_ERROR ) ;
984
984
985
985
status = load_library_prefs ();
986
986
if (status != LEDMON_STATUS_SUCCESS )
987
- return status ;
987
+ EXIT ( status ) ;
988
988
989
989
free (shortopt );
990
990
free (longopt );
991
991
if (pidfile_check (progname , NULL ) == 0 ) {
992
992
log_warning ("daemon is running..." );
993
- return LEDMON_STATUS_LEDMON_RUNNING ;
993
+ EXIT ( LEDMON_STATUS_LEDMON_RUNNING ) ;
994
994
}
995
995
if (!foreground ) {
996
996
pid_t pid = fork ();
@@ -1016,7 +1016,7 @@ int main(int argc, char *argv[])
1016
1016
int t = open ("/dev/null" , O_RDWR );
1017
1017
if (t < 0 ) {
1018
1018
log_debug ("%s: open(/dev/null) failed (errno=%d)." , __func__ , errno );
1019
- exit (EXIT_FAILURE );
1019
+ EXIT (EXIT_FAILURE );
1020
1020
}
1021
1021
UNUSED (dup (t ));
1022
1022
UNUSED (dup (t ));
@@ -1044,7 +1044,7 @@ int main(int argc, char *argv[])
1044
1044
timestamp = time (NULL );
1045
1045
if (led_scan (ctx ) != LED_STATUS_SUCCESS ) {
1046
1046
log_error ("Error on led_scan\n" );
1047
- exit (1 );
1047
+ EXIT (1 );
1048
1048
}
1049
1049
_ledmon_execute ();
1050
1050
_ledmon_wait (conf .scan_interval );
0 commit comments