aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorBin Meng <bin.meng@windriver.com>2022-10-10 12:04:30 +0800
committerKevin Wolf <kwolf@redhat.com>2022-10-27 18:33:32 +0200
commit6b6471eee11dce4c995419b68441c6637be3d90a (patch)
treef7306bdb1a0074251a8f48db065432e6ccd05785 /block.c
parentb885cdda79045791e1f33600639b7614ea114f16 (diff)
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 <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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 1 insertions, 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
}