You need to sign in or sign up before continuing.
Commit a809094b authored by Warren Dukes's avatar Warren Dukes

fix an issue with errors and new read() code on interface

git-svn-id: https://svn.musicpd.org/mpd/trunk@2683 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 469a5824
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "listen.h" #include "listen.h"
#include "playlist.h" #include "playlist.h"
#include "permission.h" #include "permission.h"
#include "sig_handlers.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -323,12 +324,16 @@ static int processBytesRead(Interface * interface, int bytesRead) { ...@@ -323,12 +324,16 @@ static int processBytesRead(Interface * interface, int bytesRead) {
} }
int interfaceReadInput(Interface * interface) { int interfaceReadInput(Interface * interface) {
int bytesRead = read(interface->fd, int bytesRead;
bytesRead = read(interface->fd,
interface->buffer+interface->bufferLength, interface->buffer+interface->bufferLength,
INTERFACE_MAX_BUFFER_LENGTH-interface->bufferLength); INTERFACE_MAX_BUFFER_LENGTH-interface->bufferLength);
if(bytesRead > 0) return processBytesRead(interface, bytesRead); if(bytesRead > 0) return processBytesRead(interface, bytesRead);
else if(bytesRead == 0 && errno!=EINTR) closeInterface(interface); else if(bytesRead == 0 || (bytesRead < 0 && errno != EINTR)) {
closeInterface(interface);
}
else return 0; else return 0;
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment