From: Bin Meng Date: Mon, 10 Oct 2022 04:04:30 +0000 (+0800) Subject: block: Ignore close() failure in get_tmp_filename() X-Git-Tag: v7.2.0~82^2~56 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6b6471eee11dce4c995419b68441c6637be3d90a;p=mirror_qemu.git block: Ignore close() failure in get_tmp_filename() The temporary file has been created and is ready for use. Checking return value of close() does not seem useful. The file descriptor is almost certainly closed; see close(2) under "Dealing with error returns from close()". Let's simply ignore close() failure here. Suggested-by: Markus Armbruster Signed-off-by: Bin Meng Reviewed-by: Markus Armbruster Message-Id: <20221010040432.3380478-1-bin.meng@windriver.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index 1fbf6b9e69..66a35b3982 100644 --- a/block.c +++ b/block.c @@ -887,10 +887,7 @@ int get_tmp_filename(char *filename, int size) if (fd < 0) { return -errno; } - if (close(fd) != 0) { - unlink(filename); - return -errno; - } + close(fd); return 0; #endif }