shutdown cleanups

now calls shairport_shutdown() when dying
This commit is contained in:
James Laird
2013-04-02 21:27:14 +11:00
parent 7603ca6f61
commit 1eca354f62
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ void die(char *format, ...) {
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
exit(1);
shairport_shutdown();
}
void warn(char *format, ...) {
+2
View File
@@ -29,4 +29,6 @@ uint8_t *rsa_apply(uint8_t *input, int inlen, int *outlen, int mode);
extern shairport_cfg config;
void shairport_shutdown(void);
#endif // _COMMON_H
+3 -3
View File
@@ -33,7 +33,7 @@
#include "mdns.h"
static int shutting_down = 0;
static void shutdown(void) {
void shairport_shutdown(void) {
if (shutting_down)
return;
shutting_down = 1;
@@ -47,7 +47,7 @@ static void shutdown(void) {
static void sig_ignore(int foo, siginfo_t *bar, void *baz) {
}
static void sig_shutdown(int foo, siginfo_t *bar, void *baz) {
shutdown();
shairport_shutdown();
}
void usage(char *progname) {
@@ -158,6 +158,6 @@ int main(int argc, char **argv) {
rtsp_listen_loop();
// should not.
shutdown();
shairport_shutdown();
return 1;
}