[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 19/54] tests/qtest: virtio-blk-test: Avoid using hardcoded /tm
From: |
Bin Meng |
Subject: |
[PATCH v4 19/54] tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp |
Date: |
Tue, 27 Sep 2022 19:05:57 +0800 |
From: Bin Meng <bin.meng@windriver.com>
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>
---
(no changes since v3)
Changes in v3:
- Split to a separate patch
tests/qtest/virtio-blk-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c
index dc5eed31c8..19c01f808b 100644
--- a/tests/qtest/virtio-blk-test.c
+++ b/tests/qtest/virtio-blk-test.c
@@ -49,10 +49,10 @@ static void drive_destroy(void *path)
static char *drive_create(void)
{
int fd, ret;
- char *t_path = g_strdup("/tmp/qtest.XXXXXX");
+ char *t_path;
/* Create a temporary raw image */
- fd = mkstemp(t_path);
+ fd = g_file_open_tmp("qtest.XXXXXX", &t_path, NULL);
g_assert_cmpint(fd, >=, 0);
ret = ftruncate(fd, TEST_IMAGE_SIZE);
g_assert_cmpint(ret, ==, 0);
--
2.34.1
- [PATCH v4 10/54] tests/qtest: generic_fuzz: Avoid using hardcoded /tmp, (continued)
- [PATCH v4 10/54] tests/qtest: generic_fuzz: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 06/54] tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 04/54] util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary files, Bin Meng, 2022/09/27
- [PATCH v4 05/54] tests/qtest: ahci-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 12/54] tests/qtest: hd-geo-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 14/54] tests/qtest: migration-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 21/54] tests/qtest: libqtest: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 19/54] tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp,
Bin Meng <=
- [PATCH v4 20/54] tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 22/54] tests/unit: test-image-locking: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 25/54] block/vvfat: Unify the mkdir() call, Bin Meng, 2022/09/27
- [PATCH v4 24/54] tests: vhost-user-bridge: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 15/54] tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 16/54] tests/qtest: qmp-test: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27
- [PATCH v4 11/54] tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp, Bin Meng, 2022/09/27