Skip to content

Commit

Permalink
tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build wa…
Browse files Browse the repository at this point in the history
…rning

When tmpfs is NULL, a build warning is seen with GCC 9.3.0.
It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this,
neither did the QEMU CI.

While we are here, improve the error message as well.

Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com>
Fixes: e6efe23 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221017132023.2228641-2-bmeng.cn@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
  • Loading branch information
lbmeng authored and vivier committed Oct 22, 2022
1 parent b1f6208 commit 1c324bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/qtest/vhost-user-test.c
Expand Up @@ -571,8 +571,8 @@ static TestServer *test_server_new(const gchar *name,

tmpfs = g_dir_make_tmp("vhost-test-XXXXXX", &err);
if (!tmpfs) {
g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs,
err->message);
g_test_message("Can't create temporary directory in %s: %s",
g_get_tmp_dir(), err->message);
g_error_free(err);
}
g_assert(tmpfs);
Expand Down

0 comments on commit 1c324bf

Please sign in to comment.