Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2017-11-01 17:45:42 +0300
committerJunio C Hamano <gitster@pobox.com>2017-11-02 07:39:13 +0300
commit9360ec0002369f3194cc5ac75ec50dab4979c988 (patch)
tree8227ae17780a1aa0e9f7216eef10b55dcabbb7c1 /sequencer.c
parentc8cee96e8a8de2e9c6f12bfac8295f1b9ee29112 (diff)
sequencer.c: check return value of close() in rewrite_file()
Not checking close(2) can hide errors as not all errors are reported during the write(2). Signed-off-by: Simon Ruderich <simon@ruderich.org> Reviewed-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index f93b60f615..e0cc2f777e 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2673,7 +2673,8 @@ static int rewrite_file(const char *path, const char *buf, size_t len)
return error_errno(_("could not open '%s' for writing"), path);
if (write_in_full(fd, buf, len) < 0)
rc = error_errno(_("could not write to '%s'"), path);
- close(fd);
+ if (close(fd) && !rc)
+ rc = error_errno(_("could not close '%s'"), path);
return rc;
}