memset(&p, 0, sizeof(p));
- strcpy(p.ts.name, ts->name);
- strcpy(p.ts.verror, ts->verror);
- strcpy(p.ts.description, ts->description);
+ strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE - 1);
+ strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE - 1);
+ strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE - 1);
p.ts.error = cpu_to_le32(ts->error);
p.ts.thread_number = cpu_to_le32(ts->thread_number);
struct fio_net_cmd cmd;
struct iovec iov[2];
- iov[0].iov_base = &cmd;
+ iov[0].iov_base = (void *) &cmd;
iov[0].iov_len = sizeof(cmd);
iov[1].iov_base = (void *) buf;
iov[1].iov_len = size;
return sk;
}
-int fio_server_parse_host(const char *host, int *ipv6, struct in_addr *inp,
+int fio_server_parse_host(const char *host, int ipv6, struct in_addr *inp,
struct in6_addr *inp6)
{
int ret = 0;
- if (*ipv6)
+ if (ipv6)
ret = inet_pton(AF_INET6, host, inp6);
else
ret = inet_pton(AF_INET, host, inp);
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
- hints.ai_family = *ipv6 ? AF_INET6 : AF_INET;
+ hints.ai_family = ipv6 ? AF_INET6 : AF_INET;
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(host, NULL, &hints, &res);
if (ret) {
log_err("fio: failed to resolve <%s> (%s)\n", host,
gai_strerror(ret));
- return 0;
+ return 1;
}
- if (*ipv6)
+ if (ipv6)
memcpy(inp6, &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr, sizeof(*inp6));
else
memcpy(inp, &((struct sockaddr_in *) res->ai_addr)->sin_addr, sizeof(*inp));
*ptr = strdup(host);
- if (fio_server_parse_host(*ptr, ipv6, inp, inp6)) {
+ if (fio_server_parse_host(*ptr, *ipv6, inp, inp6)) {
free(*ptr);
*ptr = NULL;
return 1;