diff --git a/src/daemon.c b/src/daemon.c
index 6f5073f..8f110a9 100755
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -79,20 +79,20 @@ void signal_handler(int signal)
syslog(LOG_WARNING, "Received SIGTERM signal.");
delete_pid();
//TODO: free resources
- exit(0);
+ exit(EXIT_SUCCESS);
break;
case SIGINT:
syslog(LOG_WARNING, "Received SIGINT signal.");
delete_pid();
//TODO: free resources
- exit(0);
+ exit(EXIT_SUCCESS);
case SIGSTOP:
syslog(LOG_WARNING, "Received SIGSTOP signal.");
delete_pid();
//TODO: free resources
- exit(0);
+ exit(EXIT_SUCCESS);
default:
syslog(LOG_WARNING, "Unhandled signal (%d) %s", signal, strsignal(signal));
diff --git a/src/main.c b/src/main.c
index d3d57a3..f855bae 100644
--- a/src/main.c
+++ b/src/main.c
@@ -64,7 +64,7 @@ void check_requirements()
if (uid != 0 || euid != 0) {
syslog(LOG_INFO, "%s needs root privileges. Please run %s as root. Exiting.", PROGRAM_NAME, PROGRAM_NAME);
printf("%s not started with root privileges. Please run %s as root. Exiting.\n", PROGRAM_NAME, PROGRAM_NAME);
- exit(0);
+ exit(EXIT_FAILURE);
}
/**
@@ -80,7 +80,7 @@ void check_requirements()
if (ENOENT == errno) {
syslog(LOG_INFO, "%s needs coretemp support. Please either load it or build it into the kernel. Exiting.", PROGRAM_NAME);
printf("%s needs coretemp module.\nPlease either load it or build it into the kernel. Exiting.\n", PROGRAM_NAME);
- exit(0);
+ exit(EXIT_FAILURE);
}
}
@@ -95,7 +95,7 @@ void check_requirements()
if (ENOENT == errno) {
syslog(LOG_INFO, "%s needs applesmc support. Please either load it or build it into the kernel. Exiting.", PROGRAM_NAME);
printf("%s needs applesmc module.\nPlease either load it or build it into the kernel. Exiting.\n", PROGRAM_NAME);
- exit(0);
+ exit(EXIT_FAILURE);
}
}
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
switch(c) {
case 'h':
print_usage(argc, argv);
- exit(0);
+ exit(EXIT_SUCCESS);
break;
case 'f':
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
case 't':
tests();
- exit(0);
+ exit(EXIT_SUCCESS);
break;
case 'v':
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
default:
print_usage(argc, argv);
- exit(0);
+ exit(EXIT_SUCCESS);
break;
}
}
@@ -144,5 +144,5 @@ int main(int argc, char *argv[])
// pointer to mbpfan() function in mbpfan.c
void (*fan_control)() = mbpfan;
go_daemon(fan_control);
- exit(0);
+ exit(EXIT_SUCCESS);
}
\ No newline at end of file
diff --git a/src/mbpfan.c b/src/mbpfan.c
index f396d37..3e7cb6e 100755
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -73,7 +73,7 @@ bool is_legacy_kernel()
if (atoi(str_kernel_version) != 3){
syslog(LOG_INFO, "mbpfan detected a non 3.x.x linux kernel. Detected version: %s. Exiting.\n", kernel.release);
printf("mbpfan detected a non 3.x.x linux kernel. Detected version: %s. Exiting.\n", kernel.release);
- exit(0);
+ exit(EXIT_FAILURE);
}
str_kernel_version = strtok(NULL, ".");
correct use of EXIT_SUCCESS and EXIT_FAILURE, fixes #43
473a12fd2993e96ad5a1dcce371795d299e18ebb
Daniel Graziotin <daniel@ineed.coffee> · 2014-06-29T12:42 ·
browse files at this commit
parents:
29faca5