From 74deaec6372ab2e8ff31615e8cc598504bfd75e5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 13 Jan 2015 18:23:24 +0100 Subject: [SERVER] Fix stupid bug (not using errno) --- src/server/protocol.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/server/protocol.h') 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 #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 ); -- cgit v1.2.3-55-g7522