aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Labiuk <michael.labiuk@virtuozzo.com>2022-09-30 01:35:45 +0300
committerThomas Huth <thuth@redhat.com>2022-10-11 14:06:55 +0200
commit5356d752ed9e1115c763b8d470812bb7dd912e54 (patch)
treef35ff220682bc4a265822159d3a370a73132d60e /tests
parentcb06b3d924a97312c2fb89ddcf1c1f347d040aa9 (diff)
tests/x86: replace snprint() by g_strdup_printf() in drive_del-test
Using g_autofree char* and g_strdup_printf(...) instead of ugly snprintf on stack array. Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com> Message-Id: <20220929223547.1429580-8-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/drive_del-test.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 44b9578801..106c613f4f 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -123,12 +123,10 @@ static const char *qvirtio_get_dev_type(void)
static void device_add(QTestState *qts)
{
- QDict *response;
- char driver[32];
- snprintf(driver, sizeof(driver), "virtio-blk-%s",
- qvirtio_get_dev_type());
-
- response = qtest_qmp(qts, "{'execute': 'device_add',"
+ g_autofree char *driver = g_strdup_printf("virtio-blk-%s",
+ qvirtio_get_dev_type());
+ QDict *response =
+ qtest_qmp(qts, "{'execute': 'device_add',"
" 'arguments': {"
" 'driver': %s,"
" 'drive': 'drive0',"