diff options
author | Simon Rettberg | 2017-10-31 23:21:30 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-10-31 23:21:30 +0100 |
commit | 858fef5c8fc0c1b4c237dc65499756c3664492d8 (patch) | |
tree | 9850f2f082f67f1258519d614e1edc5c6a5501d5 /src/server/net.c | |
parent | [SERVER] net.c: Refactoring and renaming (diff) | |
download | dnbd3-858fef5c8fc0c1b4c237dc65499756c3664492d8.tar.gz dnbd3-858fef5c8fc0c1b4c237dc65499756c3664492d8.tar.xz dnbd3-858fef5c8fc0c1b4c237dc65499756c3664492d8.zip |
[*] Mark logadd() as printf-style function, fix errors that it revealed
...there were quite a few format string errors as it turns out :/
Diffstat (limited to 'src/server/net.c')
-rw-r--r-- | src/server/net.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/net.c b/src/server/net.c index ee30697..e4ec666 100644 --- a/src/server/net.c +++ b/src/server/net.c @@ -40,6 +40,7 @@ #include <sys/uio.h> #endif #include <jansson.h> +#include <inttypes.h> static dnbd3_client_t *_clients[SERVER_MAX_CLIENTS]; static int _num_clients = 0; @@ -77,7 +78,7 @@ static inline bool recv_request_header(int sock, dnbd3_request_t *request) if ( errno == EINTR && ++fails < 10 ) continue; if ( ret >= 0 || ++fails > SOCKET_TIMEOUT_CLIENT_RETRIES ) return false; if ( errno == EAGAIN ) continue; - logadd( LOG_DEBUG1, "Error receiving request: Could not read message header (%d/%d, e=%d)\n", ret, (int)sizeof(*request), errno ); + logadd( LOG_DEBUG1, "Error receiving request: Could not read message header (%d/%d, e=%d)\n", (int)ret, (int)sizeof(*request), errno ); return false; } // Make sure all bytes are in the right order (endianness) @@ -122,7 +123,7 @@ static inline bool recv_request_payload(int sock, uint32_t size, serialized_buff */ static inline bool send_reply(int sock, dnbd3_reply_t *reply, void *payload) { - const size_t size = reply->size; + const uint32_t size = reply->size; fixup_reply( *reply ); if ( sock_sendAll( sock, reply, sizeof(dnbd3_reply_t), 1 ) != sizeof(dnbd3_reply_t) ) { logadd( LOG_DEBUG1, "Sending reply header to client failed" ); @@ -130,7 +131,7 @@ static inline bool send_reply(int sock, dnbd3_reply_t *reply, void *payload) } if ( size != 0 && payload != NULL ) { if ( sock_sendAll( sock, payload, size, 1 ) != (ssize_t)size ) { - logadd( LOG_DEBUG1, "Sending payload of %u bytes to client failed", size ); + logadd( LOG_DEBUG1, "Sending payload of %"PRIu32" bytes to client failed", size ); return false; } } |