From: Jens Axboe Date: Thu, 29 Nov 2012 13:35:33 +0000 (+0100) Subject: net: fix segfault with receiver, tcp, and no hostname set X-Git-Tag: fio-2.0.12~44 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=166dce4bdf2573a1641c1de5243e2465b190f0dd net: fix segfault with receiver, tcp, and no hostname set Signed-off-by: Jens Axboe --- diff --git a/engines/net.c b/engines/net.c index c5337994..101f7540 100644 --- a/engines/net.c +++ b/engines/net.c @@ -543,6 +543,15 @@ static int fio_netio_setup_connect_inet(struct thread_data *td, { struct netio_data *nd = td->io_ops->data; + if (!host) { + log_err("fio: connect with no host to connect to.\n"); + if (td_read(td)) + log_err("fio: did you forget to set 'listen'?\n"); + + td_verror(td, EINVAL, "no hostname= set"); + return 1; + } + nd->addr.sin_family = AF_INET; nd->addr.sin_port = htons(port);