aboutsummaryrefslogtreecommitdiffstats
path: root/src/sig_handlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sig_handlers.c')
-rw-r--r--src/sig_handlers.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sig_handlers.c b/src/sig_handlers.c
index 4baf060f0..55296daf6 100644
--- a/src/sig_handlers.c
+++ b/src/sig_handlers.c
@@ -19,10 +19,12 @@
#include "sig_handlers.h"
#include "player.h"
#include "playlist.h"
+#include "directory.h"
#include <signal.h>
struct sigaction original_termSa;
+struct sigaction original_hupSa;
void termSigHandler(int signal) {
if(signal==SIGTERM) {
@@ -35,6 +37,10 @@ void termSigHandler(int signal) {
void usr1SigHandler(int signal) {
}
+void hupSigHandler(int signal) {
+ readDirectoryDB();
+}
+
void initSigHandlers() {
struct sigaction sa;
@@ -46,12 +52,15 @@ void initSigHandlers() {
sigaction(SIGUSR1,&sa,NULL);
sa.sa_handler = player_sigHandler;
sigaction(SIGCHLD,&sa,NULL);
+ sa.sa_handler = hupSigHandler;
+ sigaction(SIGHUP,&sa,&original_hupSa);
sa.sa_handler = termSigHandler;
- sigaddset(&sa.sa_mask,SIGTERM);
+ /*sigaddset(&sa.sa_mask,SIGTERM);*/
sigaction(SIGTERM,&sa,&original_termSa);
}
void finishSigHandlers() {
+ sigaction(SIGHUP,&original_termSa,NULL);
sigaction(SIGTERM,&original_termSa,NULL);
}