summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-01-13 18:23:24 +0100
committerSimon Rettberg2015-01-13 18:23:24 +0100
commit74deaec6372ab2e8ff31615e8cc598504bfd75e5 (patch)
tree54adcb5a36739cc73b8050556f3a5f7c69036d55
parentFix compilation on CentOS by adding yet another endian related check (diff)
downloaddnbd3-74deaec6372ab2e8ff31615e8cc598504bfd75e5.tar.gz
dnbd3-74deaec6372ab2e8ff31615e8cc598504bfd75e5.tar.xz
dnbd3-74deaec6372ab2e8ff31615e8cc598504bfd75e5.zip
[SERVER] Fix stupid bug (not using errno)
-rw-r--r--src/server/protocol.h5
-rw-r--r--src/server/uplink.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/server/protocol.h b/src/server/protocol.h
index c0eda5b..b0a1f43 100644
--- a/src/server/protocol.h
+++ b/src/server/protocol.h
@@ -3,6 +3,7 @@
#include "../types.h"
#include "../serialize.h"
+#include <errno.h>
#define FLAGS8_SERVER (1)
@@ -19,8 +20,8 @@ static inline int dnbd3_read_reply(int sock, dnbd3_reply_t *reply, bool wait)
int ret = recv( sock, reply, sizeof(*reply), (wait ? MSG_WAITALL : MSG_DONTWAIT) | MSG_NOSIGNAL );
if ( ret == 0 ) return REPLY_CLOSED;
if ( ret < 0 ) {
- if ( ret == EAGAIN || ret == EWOULDBLOCK ) return REPLY_AGAIN;
- if ( ret == EINTR ) return REPLY_INTR;
+ if ( errno == EAGAIN || errno == EWOULDBLOCK ) return REPLY_AGAIN;
+ if ( errno == EINTR ) return REPLY_INTR;
return REPLY_ERRNO;
}
if ( !wait && ret != sizeof(*reply) ) ret += recv( sock, reply + ret, sizeof(*reply) - ret, MSG_WAITALL | MSG_NOSIGNAL );
diff --git a/src/server/uplink.c b/src/server/uplink.c
index d1ae48e..0b526fd 100644
--- a/src/server/uplink.c
+++ b/src/server/uplink.c
@@ -501,7 +501,7 @@ static void uplink_handleReceive(dnbd3_connection_t *link)
goto error_cleanup;
}
if ( ret != REPLY_OK ) {
- memlogf( "[INFO] Uplink: Connection error (%s)", link->image->path );
+ memlogf( "[INFO] Uplink: Connection error %d (%s)", ret, link->image->path );
goto error_cleanup;
}
if ( inReply.size > 9000000 ) { // TODO: Configurable