server: ensure to set proper port
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/client.c b/client.c
index 8bd39a8..2d9c0fe 100644
--- a/client.c
+++ b/client.c
@@ -176,7 +176,8 @@
if (connect(fd, (struct sockaddr *) &client->addr, sizeof(client->addr)) < 0) {
log_err("fio: connect: %s\n", strerror(errno));
- log_err("fio: failed to connect to %s\n", client->hostname);
+ log_err("fio: failed to connect to %s:%u\n", client->hostname,
+ client->port);
close(fd);
return -1;
}
diff --git a/server.c b/server.c
index 4f9b362..f7be89a 100644
--- a/server.c
+++ b/server.c
@@ -802,7 +802,6 @@
hent = gethostbyname(host);
if (!hent) {
- printf("FAIL\n");
free(*ptr);
*ptr = NULL;
return 1;
@@ -832,13 +831,12 @@
*/
static int fio_handle_server_arg(void)
{
- int is_sock, ret;
+ int is_sock, ret = 0;
saddr_in.sin_addr.s_addr = htonl(INADDR_ANY);
- saddr_in.sin_port = htons(fio_net_port);
if (!fio_server_arg)
- return 0;
+ goto out;
ret = fio_server_parse_string(fio_server_arg, &bind_sock, &is_sock,
&fio_net_port, &saddr_in.sin_addr);
@@ -848,6 +846,8 @@
bind_sock = NULL;
}
+out:
+ saddr_in.sin_port = htons(fio_net_port);
return ret;
}