struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
- unsigned int sizeof_fds = nb_fd * sizeof(int);
+ const unsigned int sizeof_fds = nb_fd * sizeof(int);
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
struct lttng_dynamic_array raw_fds;
const int fd_count = lttng_payload_view_get_fd_handle_count(view);
- lttng_dynamic_array_init(&raw_fds, sizeof(int), NULL);
+ lttng_dynamic_array_init(&raw_fds, sizeof(int), nullptr);
if (fd_count < 0) {
ret = -LTTNG_ERR_INVALID;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
- unsigned int sizeof_fds = nb_fd * sizeof(int);
+ const unsigned int sizeof_fds = nb_fd * sizeof(int);
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
struct iovec iov[1];
ssize_t ret = 0;
struct cmsghdr *cmsg;
- size_t sizeof_fds = nb_fd * sizeof(int);
+ const size_t sizeof_fds = nb_fd * sizeof(int);
#ifdef __linux__
/* Account for the struct ucred cmsg in the buffer size */
* need to expect a cmsg of the SCM_CREDENTIALS as the first control
* message.
*/
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level != SOL_SOCKET) {
fprintf(stderr, "Error: The socket needs to be of type SOL_SOCKET\n");
ret = -1;
struct iovec iov[1];
ssize_t ret = 0;
struct cmsghdr *cmsg;
- size_t sizeof_fds = nb_fd * sizeof(int);
+ const size_t sizeof_fds = nb_fd * sizeof(int);
LTTNG_ASSERT(sock);
LTTNG_ASSERT(fds);
* need to expect a cmsg of the SCM_CREDENTIALS as the first control
* message.
*/
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level != SOL_SOCKET) {
fprintf(stderr, "Error: The socket needs to be of type SOL_SOCKET\n");
ret = -1;
ssize_t ret = -1;
#if defined(__linux__) || defined(__CYGWIN__)
struct cmsghdr *cmptr;
- size_t sizeof_cred = sizeof(lttng_sock_cred);
+ const size_t sizeof_cred = sizeof(lttng_sock_cred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
lttng_sock_cred *creds;
size_t len_last;
#if defined(__linux__) || defined(__CYGWIN__)
struct cmsghdr *cmptr;
- size_t sizeof_cred = sizeof(lttng_sock_cred);
+ const size_t sizeof_cred = sizeof(lttng_sock_cred);
char anc_buf[CMSG_SPACE(sizeof_cred)];
#endif /* __linux__, __CYGWIN__ */
}
cmptr = CMSG_FIRSTHDR(&msg);
- if (cmptr == NULL) {
+ if (cmptr == nullptr) {
fprintf(stderr, "Error: Invalid control message header\n");
ret = -1;
goto end;