|
|
@ -698,7 +698,7 @@ out: |
|
|
|
|
|
|
|
|
|
|
|
/* Use a standard message across the unix sockets:
|
|
|
|
/* Use a standard message across the unix sockets:
|
|
|
|
* 4 byte length of message as little endian encoded uint32_t followed by the |
|
|
|
* 4 byte length of message as little endian encoded uint32_t followed by the |
|
|
|
* string.*/ |
|
|
|
* string. Return NULL in case of failure. */ |
|
|
|
char *recv_unix_msg(int sockd) |
|
|
|
char *recv_unix_msg(int sockd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
tv_t tv_timeout = {60, 0}; |
|
|
|
tv_t tv_timeout = {60, 0}; |
|
|
@ -712,7 +712,7 @@ char *recv_unix_msg(int sockd) |
|
|
|
ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); |
|
|
|
ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); |
|
|
|
if (ret < 1) { |
|
|
|
if (ret < 1) { |
|
|
|
LOGERR("Select1 failed in recv_unix_msg"); |
|
|
|
LOGERR("Select1 failed in recv_unix_msg"); |
|
|
|
return false; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Get message length */ |
|
|
|
/* Get message length */ |
|
|
|
ret = read(sockd, &msglen, 4); |
|
|
|
ret = read(sockd, &msglen, 4); |
|
|
@ -737,12 +737,13 @@ char *recv_unix_msg(int sockd) |
|
|
|
ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); |
|
|
|
ret = select(sockd + 1, &readfs, NULL, NULL, &tv_timeout); |
|
|
|
if (ret < 1) { |
|
|
|
if (ret < 1) { |
|
|
|
LOGERR("Select2 failed in recv_unix_msg"); |
|
|
|
LOGERR("Select2 failed in recv_unix_msg"); |
|
|
|
return false; |
|
|
|
dealloc(buf); |
|
|
|
|
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
ret = read(sockd, buf + ofs, msglen); |
|
|
|
ret = read(sockd, buf + ofs, msglen); |
|
|
|
if (unlikely(ret < 0)) { |
|
|
|
if (unlikely(ret < 0)) { |
|
|
|
LOGERR("Failed to read %d bytes in recv_unix_msg", msglen); |
|
|
|
LOGERR("Failed to read %d bytes in recv_unix_msg", msglen); |
|
|
|
ret = 1; |
|
|
|
dealloc(buf); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
ofs += ret; |
|
|
|
ofs += ret; |
|
|
|