mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
tests/qtest: virtio-blk-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-20-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
c20413558a
commit
bc989a2b87
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user