]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: Ignore close() failure in get_tmp_filename()
authorBin Meng <bin.meng@windriver.com>
Mon, 10 Oct 2022 04:04:30 +0000 (12:04 +0800)
committerKevin Wolf <kwolf@redhat.com>
Thu, 27 Oct 2022 16:33:32 +0000 (18:33 +0200)
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 <armbru@redhat.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221010040432.3380478-1-bin.meng@windriver.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c

diff --git a/block.c b/block.c
index 1fbf6b9e699b8823d7f60e214f3c7accc79b942d..66a35b398237c4cb10603600a2052177d386841d 100644 (file)
--- 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
 }