projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: sessiond app listening: use posix-compliant poll flags
[lttng-tools.git]
/
src
/
common
/
sessiond-comm
/
sessiond-comm.c
diff --git
a/src/common/sessiond-comm/sessiond-comm.c
b/src/common/sessiond-comm/sessiond-comm.c
index 24757f702a2557de7a556afcab4d079e4763ed7f..0c29003a6267a382b204a6f277a9d0a1468ad182 100644
(file)
--- a/
src/common/sessiond-comm/sessiond-comm.c
+++ b/
src/common/sessiond-comm/sessiond-comm.c
@@
-250,10
+250,12
@@
int lttcomm_listen_unix_sock(int sock)
*/
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
{
*/
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
{
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
struct iovec iov[1];
ssize_t ret = -1;
struct iovec iov[1];
ssize_t ret = -1;
+ memset(&msg, 0, sizeof(msg));
+
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
@@
-274,10
+276,12
@@
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
*/
ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len)
{
*/
ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len)
{
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
struct iovec iov[1];
ssize_t ret = -1;
struct iovec iov[1];
ssize_t ret = -1;
+ memset(&msg, 0, sizeof(msg));
+
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
@@
-304,6
+308,8
@@
int lttcomm_close_unix_sock(int sock)
perror("shutdown");
}
perror("shutdown");
}
+ close(sock);
+
return ret;
}
return ret;
}
@@
-314,7
+320,7
@@
int lttcomm_close_unix_sock(int sock)
*/
ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
{
*/
ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
{
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
@@
-322,6
+328,8
@@
ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
+ memset(&msg, 0, sizeof(msg));
+
if (nb_fd > LTTCOMM_MAX_SEND_FDS)
return -EINVAL;
if (nb_fd > LTTCOMM_MAX_SEND_FDS)
return -EINVAL;
@@
-363,9
+371,11
@@
ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
struct cmsghdr *cmsg;
size_t sizeof_fds = nb_fd * sizeof(int);
char recv_fd[CMSG_SPACE(sizeof_fds)];
struct cmsghdr *cmsg;
size_t sizeof_fds = nb_fd * sizeof(int);
char recv_fd[CMSG_SPACE(sizeof_fds)];
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
char dummy;
char dummy;
+ memset(&msg, 0, sizeof(msg));
+
/* Prepare to receive the structures */
iov[0].iov_base = &dummy;
iov[0].iov_len = 1;
/* Prepare to receive the structures */
iov[0].iov_base = &dummy;
iov[0].iov_len = 1;
@@
-419,7
+429,7
@@
end:
*/
ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len)
{
*/
ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len)
{
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
@@
-427,6
+437,8
@@
ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len)
size_t sizeof_cred = sizeof(struct ucred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
size_t sizeof_cred = sizeof(struct ucred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
+ memset(&msg, 0, sizeof(msg));
+
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
@@
-462,13
+474,15
@@
ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len)
ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
struct ucred *creds)
{
ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
struct ucred *creds)
{
- struct msghdr msg
= { 0 }
;
+ struct msghdr msg;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret;
size_t sizeof_cred = sizeof(struct ucred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret;
size_t sizeof_cred = sizeof(struct ucred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
+ memset(&msg, 0, sizeof(msg));
+
/* Not allowed */
if (creds == NULL) {
ret = -1;
/* Not allowed */
if (creds == NULL) {
ret = -1;
This page took
0.025242 seconds
and
4
git commands to generate.