Browse Source

libckpool - report errno with _recv_unix_msg errors

master
kanoi 10 years ago
parent
commit
0608a79f14
  1. 14
      src/libckpool.c

14
src/libckpool.c

@ -948,17 +948,19 @@ char *_recv_unix_msg(int sockd, int timeout1, int timeout2, const char *file, co
{ {
char *buf = NULL; char *buf = NULL;
uint32_t msglen; uint32_t msglen;
int ret; int ret, ern;
ret = wait_read_select(sockd, timeout1); ret = wait_read_select(sockd, timeout1);
if (unlikely(ret < 1)) { if (unlikely(ret < 1)) {
LOGERR("Select1 failed in recv_unix_msg"); ern = errno;
LOGERR("Select1 failed in recv_unix_msg (%d)", ern);
goto out; goto out;
} }
/* Get message length */ /* Get message length */
ret = read_length(sockd, &msglen, 4); ret = read_length(sockd, &msglen, 4);
if (unlikely(ret < 4)) { if (unlikely(ret < 4)) {
LOGERR("Failed to read 4 byte length in recv_unix_msg"); ern = errno;
LOGERR("Failed to read 4 byte length in recv_unix_msg (%d?)", ern);
goto out; goto out;
} }
msglen = le32toh(msglen); msglen = le32toh(msglen);
@ -968,13 +970,15 @@ char *_recv_unix_msg(int sockd, int timeout1, int timeout2, const char *file, co
} }
ret = wait_read_select(sockd, timeout2); ret = wait_read_select(sockd, timeout2);
if (unlikely(ret < 1)) { if (unlikely(ret < 1)) {
LOGERR("Select2 failed in recv_unix_msg"); ern = errno;
LOGERR("Select2 failed in recv_unix_msg (%d)", ern);
goto out; goto out;
} }
buf = ckzalloc(msglen + 1); buf = ckzalloc(msglen + 1);
ret = read_length(sockd, buf, msglen); ret = read_length(sockd, buf, msglen);
if (unlikely(ret < (int)msglen)) { if (unlikely(ret < (int)msglen)) {
LOGERR("Failed to read %u bytes in recv_unix_msg", msglen); ern = errno;
LOGERR("Failed to read %u bytes in recv_unix_msg (%d?)", msglen, ern);
dealloc(buf); dealloc(buf);
} }
out: out:

Loading…
Cancel
Save