From: Castor Fu Date: Fri, 22 Aug 2014 22:16:44 +0000 (-0500) Subject: Fix crash in client with NULL hostname X-Git-Tag: fio-2.1.12~3 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=9a4424c81b146b9a08b105af9e53d8435e888cd1;ds=sidebyside Fix crash in client with NULL hostname Fix this by adding an empty hostname. Signed-off-by: Jens Axboe --- diff --git a/client.c b/client.c index 1f527343..1dded096 100644 --- a/client.c +++ b/client.c @@ -823,9 +823,11 @@ static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src) } static void json_object_add_client_info(struct json_object *obj, -struct fio_client *client) + struct fio_client *client) { - json_object_add_value_string(obj, "hostname", client->hostname); + const char *hostname = client->hostname ? client->hostname : ""; + + json_object_add_value_string(obj, "hostname", hostname); json_object_add_value_int(obj, "port", client->port); }