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>
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;
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);