projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 2.5.0-rc2
[lttng-ust.git]
/
liblttng-ust-comm
/
lttng-ust-comm.c
diff --git
a/liblttng-ust-comm/lttng-ust-comm.c
b/liblttng-ust-comm/lttng-ust-comm.c
index 5321922d5278f84d544a2005fa955e2d5ad42aa9..751ad2e3cf2add1ffd805c9ca4df802034e793b1 100644
(file)
--- a/
liblttng-ust-comm/lttng-ust-comm.c
+++ b/
liblttng-ust-comm/lttng-ust-comm.c
@@
-265,7
+265,8
@@
ssize_t ustcomm_recv_unix_sock(int sock, void *buf, size_t len)
{
struct msghdr msg;
struct iovec iov[1];
{
struct msghdr msg;
struct iovec iov[1];
- ssize_t ret;
+ ssize_t ret = -1;
+ size_t len_last;
memset(&msg, 0, sizeof(msg));
memset(&msg, 0, sizeof(msg));
@@
-275,8
+276,14
@@
ssize_t ustcomm_recv_unix_sock(int sock, void *buf, size_t len)
msg.msg_iovlen = 1;
do {
msg.msg_iovlen = 1;
do {
+ len_last = iov[0].iov_len;
ret = recvmsg(sock, &msg, 0);
ret = recvmsg(sock, &msg, 0);
- } while (ret < 0 && errno == EINTR);
+ if (ret > 0) {
+ iov[0].iov_base += ret;
+ iov[0].iov_len -= ret;
+ assert(ret <= len_last);
+ }
+ } while ((ret > 0 && ret < len_last) || (ret < 0 && errno == EINTR));
if (ret < 0) {
int shutret;
if (ret < 0) {
int shutret;
@@
-290,7
+297,10
@@
ssize_t ustcomm_recv_unix_sock(int sock, void *buf, size_t len)
shutret = shutdown(sock, SHUT_RDWR);
if (shutret)
ERR("Socket shutdown error");
shutret = shutdown(sock, SHUT_RDWR);
if (shutret)
ERR("Socket shutdown error");
+ } else if (ret > 0) {
+ ret = len;
}
}
+ /* ret = 0 means an orderly shutdown. */
return ret;
}
return ret;
}
@@
-956,6
+966,8
@@
int ustcomm_register_event(int sock,
if (len < 0) {
return len;
}
if (len < 0) {
return len;
}
+ } else {
+ free(fields);
}
if (model_emf_uri_len) {
}
if (model_emf_uri_len) {
@@
-1062,6
+1074,8
@@
int ustcomm_register_channel(int sock,
if (len < 0) {
return len;
}
if (len < 0) {
return len;
}
+ } else {
+ free(fields);
}
len = ustcomm_recv_unix_sock(sock, &reply, sizeof(reply));
}
len = ustcomm_recv_unix_sock(sock, &reply, sizeof(reply));
This page took
0.023819 seconds
and
4
git commands to generate.