sockets_num++;
break;
} else {
- int yes = 1;
-
status = setsockopt(sockets[sockets_num].fd, SOL_SOCKET, SO_REUSEADDR,
- (void *)&yes, sizeof(yes));
+ &(int){1}, sizeof(int));
if (status != 0) {
WARNING("gmond plugin: setsockopt(2) failed: %s", STRERRNO);
}
#else
int loop = 0;
#endif
- int yes = 1;
/* allow multiple sockets to use the same PORT number */
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) == -1) {
ERROR("network plugin: setsockopt (reuseaddr): %s", STRERRNO);
return -1;
}
static int pb_add_socket(pinba_socket_t *s, /* {{{ */
const struct addrinfo *ai) {
- int fd;
- int tmp;
- int status;
if (s->fd_num == PINBA_MAX_SOCKETS) {
WARNING("pinba plugin: Sorry, you have hit the built-in limit of "
return -1;
}
- fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ int fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (fd < 0) {
ERROR("pinba plugin: socket(2) failed: %s", STRERRNO);
return 0;
}
- tmp = 1;
- status = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
+ int status = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
if (status != 0) {
WARNING("pinba plugin: setsockopt(SO_REUSEADDR) failed: %s", STRERRNO);
}
if (fd == -1)
continue;
- int tmp = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)) != 0) {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) != 0) {
WARNING("write_prometheus: setsockopt(SO_REUSEADDR) failed: %s",
STRERRNO);
close(fd);