In daemon mode, send error messages to parent to write them on stderr.
This allows to get a better error message than "Spawning the daemon failed." when initialization fails. The error message is sent through the pipe. When init is OK, just send a null byte.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include "common.h"
|
||||
#include "daemon.h"
|
||||
|
||||
shairport_cfg config;
|
||||
|
||||
@@ -41,10 +42,16 @@ int debuglev = 0;
|
||||
|
||||
void die(char *format, ...) {
|
||||
fprintf(stderr, "FATAL: ");
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
vfprintf(stderr, format, args);
|
||||
if (config.daemonise)
|
||||
daemon_fail(format, args); // Send error message to parent
|
||||
|
||||
va_end(args);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
shairport_shutdown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user