diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/interface.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/interface.c b/src/interface.c index 110e3e475..9cb256725 100644 --- a/src/interface.c +++ b/src/interface.c @@ -24,6 +24,7 @@ #include "listen.h" #include "playlist.h" #include "permission.h" +#include "sig_handlers.h" #include <stdio.h> #include <stdlib.h> @@ -323,12 +324,16 @@ static int processBytesRead(Interface * interface, int bytesRead) { } int interfaceReadInput(Interface * interface) { - int bytesRead = read(interface->fd, + int bytesRead; + + bytesRead = read(interface->fd, interface->buffer+interface->bufferLength, INTERFACE_MAX_BUFFER_LENGTH-interface->bufferLength); - + 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; return 1; |