[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/58] block: Ignore close() failure in get_tmp_filename()
From: |
Kevin Wolf |
Subject: |
[PULL 02/58] block: Ignore close() failure in get_tmp_filename() |
Date: |
Thu, 27 Oct 2022 20:30:50 +0200 |
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>
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 | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
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
}
--
2.37.3
- [PULL 00/58] Block layer patches, Kevin Wolf, 2022/10/27
- [PULL 01/58] MAINTAINERS: Fold "Block QAPI, monitor, ..." into "Block layer core", Kevin Wolf, 2022/10/27
- [PULL 03/58] block: Refactor get_tmp_filename(), Kevin Wolf, 2022/10/27
- [PULL 02/58] block: Ignore close() failure in get_tmp_filename(),
Kevin Wolf <=
- [PULL 07/58] vhost-user-blk: fix the resize crash, Kevin Wolf, 2022/10/27
- [PULL 05/58] vvfat: allow spaces in file names, Kevin Wolf, 2022/10/27
- [PULL 08/58] block: BlockDriver: add .filtered_child_is_backing field, Kevin Wolf, 2022/10/27
- [PULL 04/58] vvfat: allow some writes to bootsector, Kevin Wolf, 2022/10/27
- [PULL 13/58] test-bdrv-graph-mod: fix filters to be filters, Kevin Wolf, 2022/10/27
- [PULL 10/58] block/blklogwrites: don't care to remove bs->file child on failure, Kevin Wolf, 2022/10/27
- [PULL 12/58] tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing, Kevin Wolf, 2022/10/27
- [PULL 11/58] test-bdrv-graph-mod: update test_parallel_perm_update test case, Kevin Wolf, 2022/10/27
- [PULL 09/58] block: introduce bdrv_open_file_child() helper, Kevin Wolf, 2022/10/27
- [PULL 14/58] block: document connection between child roles and bs->backing/bs->file, Kevin Wolf, 2022/10/27