qemu-e2k/include
Bin Meng 69fbfff95e block: Refactor get_tmp_filename()
At present there are two callers of get_tmp_filename() and they are
inconsistent.

One does:

    /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
    char *tmp_filename = g_malloc0(PATH_MAX + 1);
    ...
    ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);

while the other does:

    s->qcow_filename = g_malloc(PATH_MAX);
    ret = get_tmp_filename(s->qcow_filename, PATH_MAX);

As we can see different 'size' arguments are passed. There are also
platform specific implementations inside the function, and the use
of snprintf is really undesirable.

The function name is also misleading. It creates a temporary file,
not just a filename.

Refactor this routine by changing its name and signature to:

    char *create_tmp_file(Error **errp)

and use g_get_tmp_dir() / g_mkstemp() for a consistent implementation.

While we are here, add some comments to mention that /var/tmp is
preferred over /tmp on non-win32 hosts.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20221010040432.3380478-2-bin.meng@windriver.com>
[kwolf: Fixed incorrect errno negation and iotest 051]
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-10-27 20:13:32 +02:00
..
authz
block block: Refactor get_tmp_filename() 2022-10-27 20:13:32 +02:00
chardev
crypto
disas
exec accel/tcg: Remove restore_state_to_opc function 2022-10-26 11:11:28 +10:00
fpu
hw dump queue 2022-10-26 10:53:49 -04:00
io io/command: implement support for win32 2022-10-12 19:22:01 +04:00
libdecnumber
migration
monitor hmp: add virtio commands 2022-10-09 16:38:45 -04:00
net
qapi
qemu include/qemu/thread: Use qatomic_* functions 2022-10-26 11:11:28 +10:00
qom
scsi
semihosting
standard-headers m68k: rework BI_VIRT_RNG_SEED as BI_RNG_SEED 2022-10-21 20:46:10 +02:00
sysemu s390x: pv: Add dump support 2022-10-26 12:54:59 +04:00
tcg
ui
user
elf.h include/elf.h: add s390x note types 2022-10-26 12:54:59 +04:00
glib-compat.h
qemu-io.h
qemu-main.h