Re: Confusing git messages when disk is full.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 15, 2017, 22:28 UTC
- Message-ID
- <xmqq7f4r2io5.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170215215151.a5chtxyjhbe3og4p@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
>> abort:
>> strbuf_release(¬e);
>> free(url);
>> - fclose(fp);
>> + if (ferror(fp))
>> + rc = -1;
>> + if (fclose(fp))
>> + rc = -1;
>> return rc;
>
> Yeah, I think this works. Normally you'd want to flush before checking
> ferror(), but since you detect errors from fclose, too, it should be
> fine.
>
> We probably should write something stderr, though. Maybe:
>
> if (ferror(fp) || fclose(fp))
> rc = error_errno("unable to write to %s", filename);Yes, and somehow make sure we do fclose(fp) even when we have an error already ;-)