fix some signal handling
git-svn-id: https://svn.musicpd.org/mpd/trunk@3101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user