net: fix segfault with receiver, tcp, and no hostname set
authorJens Axboe <axboe@kernel.dk>
Thu, 29 Nov 2012 13:35:33 +0000 (14:35 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Nov 2012 13:35:33 +0000 (14:35 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/net.c

index c5337994fa41509acad7a4cf91003b0ac1422503..101f7540789b9994a084777e02529e4be102429b 100644 (file)
@@ -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);