qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 1/2] block: Ignore close() failure in get_tmp_filename()
@ 2022-10-10  4:04 Bin Meng
  2022-10-10  4:04 ` [PATCH v6 2/2] block: Refactor get_tmp_filename() Bin Meng
  2022-10-21  9:25 ` [PATCH v6 1/2] block: Ignore close() failure in get_tmp_filename() Kevin Wolf
  0 siblings, 2 replies; 5+ messages in thread
From: Bin Meng @ 2022-10-10  4:04 UTC (permalink / raw)
  To: Marc-André Lureau, Daniel P . Berrangé,
	Markus Armbruster
  Cc: Hanna Reitz, Kevin Wolf, qemu-block, qemu-devel

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

(no changes since v5)

Changes in v5:
- new patch: "block: Ignore close() failure in get_tmp_filename()"

 block.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block.c b/block.c
index bc85f46eed..582c205307 100644
--- a/block.c
+++ b/block.c
@@ -886,10 +886,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
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-21  9:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10  4:04 [PATCH v6 1/2] block: Ignore close() failure in get_tmp_filename() Bin Meng
2022-10-10  4:04 ` [PATCH v6 2/2] block: Refactor get_tmp_filename() Bin Meng
2022-10-16 13:22   ` Bin Meng
2022-10-21  9:16   ` Kevin Wolf
2022-10-21  9:25 ` [PATCH v6 1/2] block: Ignore close() failure in get_tmp_filename() Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).