Return a nonzero value on error

This commit is contained in:
James Laird
2013-10-14 19:50:48 +11:00
parent 3b028bc337
commit 28b4e6dde2
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ void die(char *format, ...) {
va_end(args);
fprintf(stderr, "\n");
shairport_shutdown();
shairport_shutdown(1);
}
void warn(char *format, ...) {
+1 -1
View File
@@ -46,7 +46,7 @@ uint8_t *rsa_apply(uint8_t *input, int inlen, int *outlen, int mode);
extern shairport_cfg config;
void shairport_shutdown(void);
void shairport_shutdown(int retval);
void shairport_startup_complete(void);
#endif // _COMMON_H
+5 -4
View File
@@ -41,7 +41,8 @@
static void log_setup();
static int shutting_down = 0;
void shairport_shutdown(void) {
void shairport_shutdown(int retval) {
if (shutting_down)
return;
shutting_down = 1;
@@ -52,13 +53,13 @@ void shairport_shutdown(void) {
config.output->deinit();
daemon_exit(); // This does nothing if not in daemon mode
exit(0);
exit(retval);
}
static void sig_ignore(int foo, siginfo_t *bar, void *baz) {
}
static void sig_shutdown(int foo, siginfo_t *bar, void *baz) {
shairport_shutdown();
shairport_shutdown(0);
}
static void sig_child(int foo, siginfo_t *bar, void *baz) {
@@ -282,6 +283,6 @@ int main(int argc, char **argv) {
rtsp_listen_loop();
// should not.
shairport_shutdown();
shairport_shutdown(1);
return 1;
}