Tidy up the exit() arguments.
This commit is contained in:
@@ -176,7 +176,7 @@ void die(const char *format, ...) {
|
||||
else
|
||||
sps_log(LOG_ERR, "fatal error: %s", s);
|
||||
pthread_setcancelstate(oldState, NULL);
|
||||
abort();
|
||||
abort(); // exit() doesn't always work, by heaven.
|
||||
}
|
||||
|
||||
void warn(const char *format, ...) {
|
||||
@@ -687,7 +687,7 @@ void command_set_volume(double volume) {
|
||||
execv(argV[0], argV);
|
||||
warn("Execution of on-set-volume command \"%s\" failed to start", config.cmd_set_volume);
|
||||
// debug(1, "Error executing on-set-volume command %s", config.cmd_set_volume);
|
||||
exit(127); /* only if execv fails */
|
||||
exit(EXIT_FAILURE); /* only if execv fails */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ void command_start(void) {
|
||||
execv(argV[0], argV);
|
||||
warn("Execution of on-start command failed to start");
|
||||
debug(1, "Error executing on-start command %s", config.cmd_start);
|
||||
exit(127); /* only if execv fails */
|
||||
exit(EXIT_FAILURE); /* only if execv fails */
|
||||
}
|
||||
} else {
|
||||
if (config.cmd_blocking || config.cmd_start_returns_output) { /* pid!=0 means parent process
|
||||
@@ -798,7 +798,7 @@ void command_execute(const char *command, const char *extra_argument, const int
|
||||
execv(argV[0], argV);
|
||||
warn("Execution of command \"%s\" failed to start", full_command);
|
||||
debug(1, "Error executing command \"%s\".", full_command);
|
||||
exit(127); /* only if execv fails */
|
||||
exit(EXIT_FAILURE); /* only if execv fails */
|
||||
}
|
||||
} else {
|
||||
if (block) { /* pid!=0 means parent process and if blocking is true, wait for
|
||||
|
||||
@@ -92,8 +92,7 @@ void response_body(void *opaque, const char *data, int size) {
|
||||
if (t)
|
||||
response->body = t;
|
||||
else {
|
||||
debug(1, "Can't allocate any more space for parser.\n");
|
||||
exit(-1);
|
||||
die("dacp: can't allocate any more space for parser.");
|
||||
}
|
||||
}
|
||||
memcpy(response->body + response->size, data, size);
|
||||
|
||||
+2
-3
@@ -65,9 +65,8 @@ static int fork_execvp(const char *file, char *const argv[]) {
|
||||
// Write erno's value into the pipe and exit.
|
||||
if (write(execpipe[1], &errno, sizeof(errno)) != sizeof(errno))
|
||||
debug(1, "Execve has failed and there was a further error writing an error message, duh.");
|
||||
debug(1, "execve has failed.");
|
||||
_exit(-1);
|
||||
return 0; // Just to make the compiler happy.
|
||||
die("mdns_external: execve has failed.");
|
||||
// return 0; // Just to make the compiler happy.
|
||||
} else { // Parent
|
||||
close(execpipe[1]); // Close the write end
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc > 2) {
|
||||
poptPrintHelp(optCon, stderr, 0);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Now do options processing */
|
||||
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc > 2) {
|
||||
poptPrintHelp(optCon, stderr, 0);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Now do options processing */
|
||||
|
||||
+5
-5
@@ -123,7 +123,7 @@ static void sig_shutdown(__attribute__((unused)) int foo, __attribute__((unused)
|
||||
daemon_pid_file_remove();
|
||||
}
|
||||
#endif
|
||||
exit(0);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static void sig_child(__attribute__((unused)) int foo, __attribute__((unused)) siginfo_t *bar,
|
||||
@@ -1033,7 +1033,7 @@ int parse_options(int argc, char **argv) {
|
||||
/* Check if we are called with -d or --daemon or -j or justDaemoniseNoPIDFile options*/
|
||||
if ((daemonisewith != 0) || (daemonisewithout != 0)) {
|
||||
fprintf(stderr,"%s was built without libdaemon, so does not support daemonisation using the -d, --deamon, -j or --justDaemoniseNoPIDFile options\n",config.appName);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1218,7 +1218,7 @@ void main_cleanup_handler(__attribute__((unused)) void *arg) {
|
||||
#endif
|
||||
|
||||
debug(2, "Exit...");
|
||||
exit(0);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void exit_function() {
|
||||
@@ -1346,13 +1346,13 @@ int main(int argc, char **argv) {
|
||||
/* Check if we are called with -V or --version parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0))) {
|
||||
print_version();
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Check if we are called with -h or --help parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0))) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LIBDAEMON
|
||||
|
||||
Reference in New Issue
Block a user