On Sat, Sep 24, 2022 at 04:00:34PM +0800, Bin Meng wrote: > From: Bin Meng <bin.m...@windriver.com> > > 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 this use > of snprintf is really undesirable. > > Refactor this routine by changing its signature to: > > char *get_tmp_filename(void) > > and use g_file_open_tmp() for a consistent implementation. > > Signed-off-by: Bin Meng <bin.m...@windriver.com> > --- > > include/block/block_int-common.h | 2 +- > block.c | 42 ++++++++++---------------------- > block/vvfat.c | 8 +++--- > 3 files changed, 18 insertions(+), 34 deletions(-)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|