Merge branch 'jk/tempfile-ferror-fclose-confusion' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 21 Mar 2017 22:03:28 +0000 (15:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Mar 2017 22:03:28 +0000 (15:03 -0700)
commitf63df942a3f4245970192161dab259922819e3b5
treeff1d6a0dc1219487ca8daf7fe6f660574a5d05b9
parent0d9f9424ad12c8e9e71db45776f6bf4a143b90f3
parent7e8c9355b7aa61948275c8144dff6857f4b0ee51
Merge branch 'jk/tempfile-ferror-fclose-confusion' into maint

A caller of tempfile API that uses stdio interface to write to
files may ignore errors while writing, which is detected when
tempfile is closed (with a call to ferror()).  By that time, the
original errno that may have told us what went wrong is likely to
be long gone and was overwritten by an irrelevant value.
close_tempfile() now resets errno to EIO to make errno at least
predictable.

* jk/tempfile-ferror-fclose-confusion:
  tempfile: set errno to a known value before calling ferror()