diff options
author | Bin Meng <bin.meng@windriver.com> | 2022-09-25 19:29:58 +0800 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2022-09-27 20:51:20 +0200 |
commit | 28ea545b33f79dfd734d9a842a3a2cc9bf89d5e8 (patch) | |
tree | 57609e6e24399afb88b4ed85ce327c9c8b5a8906 /tests | |
parent | bc989a2b870629276fcbb9f5ee380d5c53e145cc (diff) | |
download | qemu-28ea545b33f79dfd734d9a842a3a2cc9bf89d5e8.zip qemu-28ea545b33f79dfd734d9a842a3a2cc9bf89d5e8.tar.gz qemu-28ea545b33f79dfd734d9a842a3a2cc9bf89d5e8.tar.bz2 |
tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp
This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_tmp() for a portable implementation.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-21-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/virtio-scsi-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/qtest/virtio-scsi-test.c b/tests/qtest/virtio-scsi-test.c index 8ceb12a..ceaa7f2 100644 --- a/tests/qtest/virtio-scsi-test.c +++ b/tests/qtest/virtio-scsi-test.c @@ -268,7 +268,7 @@ static void test_iothread_attach_node(void *obj, void *data, QVirtioSCSIPCI *scsi_pci = obj; QVirtioSCSI *scsi = &scsi_pci->scsi; QVirtioSCSIQueues *vs; - char tmp_path[] = "/tmp/qtest.XXXXXX"; + g_autofree char *tmp_path = NULL; int fd; int ret; @@ -282,7 +282,7 @@ static void test_iothread_attach_node(void *obj, void *data, vs = qvirtio_scsi_init(scsi->vdev); /* Create a temporary qcow2 overlay*/ - fd = mkstemp(tmp_path); + fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); g_assert(fd >= 0); close(fd); |