[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 1/2] block: Ignore close() failure in get_tmp_filename()
From: |
Bin Meng |
Subject: |
[PATCH v5 1/2] block: Ignore close() failure in get_tmp_filename() |
Date: |
Wed, 28 Sep 2022 22:41:24 +0800 |
From: Bin Meng <bin.meng@windriver.com>
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>
---
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.34.1
- [PATCH v5 1/2] block: Ignore close() failure in get_tmp_filename(),
Bin Meng <=