diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-04-11 00:52:05 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-04-11 00:52:05 +0000 |
commit | 171a7752a8fab0e1c55be1469a331ef20a7b3755 (patch) | |
tree | 33a74b690d0567116d4ab8d681d6499a232ecb9c /src/sig_handlers.c | |
parent | 8c4bc2d2d499951107572b10e5a99ab2913f3aea (diff) | |
download | mpd-171a7752a8fab0e1c55be1469a331ef20a7b3755.tar.gz mpd-171a7752a8fab0e1c55be1469a331ef20a7b3755.tar.xz mpd-171a7752a8fab0e1c55be1469a331ef20a7b3755.zip |
add --only-create-db option from msells
have SIGHUP cause rereading db file
git-svn-id: https://svn.musicpd.org/mpd/trunk@663 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/sig_handlers.c')
-rw-r--r-- | src/sig_handlers.c | 11 |
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); } |