aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-19 12:28:47 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-19 12:28:47 +0000
commit9193766c06e06fbf36ce0fc593be4c0687d47ac8 (patch)
treed756d9713e601be6c4272da25dd9aa7b54c94efc /src
parentd392b7e48b2b589a24f9a790fbb8e14dbac36993 (diff)
downloadmpd-9193766c06e06fbf36ce0fc593be4c0687d47ac8.tar.gz
mpd-9193766c06e06fbf36ce0fc593be4c0687d47ac8.tar.xz
mpd-9193766c06e06fbf36ce0fc593be4c0687d47ac8.zip
fix some signal handling
git-svn-id: https://svn.musicpd.org/mpd/trunk@3101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/decode.c10
-rw-r--r--src/interface.c11
-rw-r--r--src/sig_handlers.c7
3 files changed, 13 insertions, 15 deletions
diff --git a/src/decode.c b/src/decode.c
index 0ffa9f87e..c91b5c92a 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -44,9 +44,7 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
int status;
if(decode_pid==wait3(&status,WNOHANG,NULL)) {
if(WIFSIGNALED(status)) {
- if(WTERMSIG(status)!=SIGTERM &&
- WTERMSIG(status)!=SIGINT)
- {
+ if(WTERMSIG(status)!=SIGTERM) {
ERROR("decode process died from "
"signal: %i\n",
WTERMSIG(status));
@@ -65,12 +63,6 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
else DEBUG("decoder (or child) got SIGTERM\n");
exit(EXIT_SUCCESS);
}
- else if(sig==SIGINT) {
- if(decode_pid > 0) {
- DEBUG("player (or child) got SIGINT\n");
- }
- else DEBUG("decoder (or child) got SIGINT\n");
- }
}
void stopDecode(DecoderControl * dc) {
diff --git a/src/interface.c b/src/interface.c
index fac7af771..9b8c09d32 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -629,11 +629,15 @@ void printInterfaceOutBuffer(Interface * interface) {
char * buffer;
int ret;
+ DEBUG("enter print interface out buffer\n");
+
if(!interface->open || interface->expired || !interface->outBuflen) {
+ DEBUG("nothing todo, leaving\n");
return;
}
if(interface->bufferList) {
+ DEBUG("we have a bufferList\n");
interface->outputBufferSize+=sizeof(ListNode);
interface->outputBufferSize+=interface->outBuflen+1;
if(interface->outputBufferSize>
@@ -658,9 +662,12 @@ void printInterfaceOutBuffer(Interface * interface) {
}
}
else {
+ DEBUG("no bufferList, just generic buffer\n");
+ DEBUG("attempting to write\n");
if((ret = write(interface->fd,interface->outBuffer,
interface->outBuflen))<0)
{
+ DEBUG("write unsuccessful\n");
if(errno==EAGAIN || errno==EINTR) {
buffer = malloc(interface->outBuflen+1);
memcpy(buffer,interface->outBuffer,
@@ -678,6 +685,7 @@ void printInterfaceOutBuffer(Interface * interface) {
}
}
else if(ret<interface->outBuflen) {
+ DEBUG("returned less than outBufLen\n");
buffer = malloc(interface->outBuflen-ret+1);
memcpy(buffer,interface->outBuffer+ret,
interface->outBuflen-ret);
@@ -694,7 +702,10 @@ void printInterfaceOutBuffer(Interface * interface) {
(char *)interface->bufferList->
firstNode->data)+1;
}
+ DEBUG("done writing\n");
}
interface->outBuflen = 0;
+
+ DEBUG("leaving print interface out buffer\n");
}
diff --git a/src/sig_handlers.c b/src/sig_handlers.c
index 4c7b99635..a3bf93050 100644
--- a/src/sig_handlers.c
+++ b/src/sig_handlers.c
@@ -72,9 +72,7 @@ void initSigHandlers() {
struct sigaction sa;
sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
- sa.sa_sigaction = NULL;
while(sigaction(SIGPIPE,&sa,NULL)<0 && errno==EINTR);
sa.sa_handler = chldSigHandler;
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
@@ -97,16 +95,13 @@ void setSigHandlersForDecoder() {
finishSigHandlers();
sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
- sa.sa_sigaction = NULL;
while(sigaction(SIGHUP,&sa,NULL)<0 && errno==EINTR);
- sa.sa_handler = NULL;
+ while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = decodeSigHandler;
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
- while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
}
void ignoreSignals() {