Merge branches 'fix-obinary', 'net-client-eof-handling' and 'report-bind-errors'

This commit is contained in:
Oliver Jowett 2014-10-01 12:41:28 +01:00
commit 622b158367
2 changed files with 10 additions and 3 deletions

View file

@ -838,7 +838,13 @@ int main(int argc, char **argv) {
} else { } else {
if (Modes.filename[0] == '-' && Modes.filename[1] == '\0') { if (Modes.filename[0] == '-' && Modes.filename[1] == '\0') {
Modes.fd = STDIN_FILENO; Modes.fd = STDIN_FILENO;
} else if ((Modes.fd = open(Modes.filename, (O_RDONLY | O_BINARY))) == -1) { } else if ((Modes.fd = open(Modes.filename,
#ifdef _WIN32
(O_RDONLY | O_BINARY)
#else
(O_RDONLY)
#endif
)) == -1) {
perror("Opening data file"); perror("Opening data file");
exit(1); exit(1);
} }

View file

@ -88,7 +88,7 @@ void modesInitNet(void) {
int s = anetTcpServer(Modes.aneterr, services[j].port, NULL); int s = anetTcpServer(Modes.aneterr, services[j].port, NULL);
if (s == -1) { if (s == -1) {
fprintf(stderr, "Error opening the listening port %d (%s): %s\n", fprintf(stderr, "Error opening the listening port %d (%s): %s\n",
services[j].port, services[j].descr, strerror(errno)); services[j].port, services[j].descr, Modes.aneterr);
exit(1); exit(1);
} }
anetNonBlock(Modes.aneterr, s); anetNonBlock(Modes.aneterr, s);
@ -851,11 +851,12 @@ void modesReadFromClient(struct client *c, char *sep,
bContinue = 0; bContinue = 0;
} }
#ifndef _WIN32 #ifndef _WIN32
if ( (nread < 0) && (errno != EAGAIN)) { // Error, or end of file if ( (nread < 0 && errno != EAGAIN && errno != EWOULDBLOCK) || nread == 0 ) { // Error, or end of file
#else #else
if ( (nread < 0) && (errno != EWOULDBLOCK)) { // Error, or end of file if ( (nread < 0) && (errno != EWOULDBLOCK)) { // Error, or end of file
#endif #endif
modesFreeClient(c); modesFreeClient(c);
return;
} }
if (nread <= 0) { if (nread <= 0) {
break; // Serve next client break; // Serve next client