зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
c8cee96e8a
Коммит
9360ec0002
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче