From 48a693427acb70c81008b65951c5904d6616f3bb Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 15 Oct 2014 14:59:01 +1100 Subject: [PATCH] libckpool - add errno to some socket write error messages --- src/libckpool.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index 32d08a98..8d1a66d8 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -813,7 +813,7 @@ bool _send_unix_msg(int sockd, const char *buf, const char *file, const char *fu { uint32_t msglen, len; bool retval = false; - int ret; + int ret, ern; if (unlikely(!buf)) { LOGWARNING("Null message sent to send_unix_msg"); @@ -827,22 +827,26 @@ bool _send_unix_msg(int sockd, const char *buf, const char *file, const char *fu msglen = htole32(len); ret = wait_write_select(sockd, 5); if (unlikely(ret < 1)) { - LOGERR("Select1 failed in send_unix_msg"); + ern = errno; + LOGERR("Select1 failed in send_unix_msg (%d)", ern); goto out; } ret = write_length(sockd, &msglen, 4); if (unlikely(ret < 4)) { - LOGERR("Failed to write 4 byte length in send_unix_msg"); + ern = errno; + LOGERR("Failed to write 4 byte length in send_unix_msg (%d)", ern); goto out; } ret = wait_write_select(sockd, 5); if (unlikely(ret < 1)) { - LOGERR("Select2 failed in send_unix_msg"); + ern = errno; + LOGERR("Select2 failed in send_unix_msg (%d)", ern); goto out; } ret = write_length(sockd, buf, len); if (unlikely(ret < 0)) { - LOGERR("Failed to write %d bytes in send_unix_msg", len); + ern = errno; + LOGERR("Failed to write %d bytes in send_unix_msg (%d)", len, ern); goto out; } retval = true;