Thread (2 messages) flat view 2 messages, 2 authors, 2017-02-15

Re: Confusing git messages when disk is full.

From: Junio C Hamano <hidden>
Date: 2017-02-15 22:28:18

Jeff King [off-list ref] writes:
quoted
  abort:
 	strbuf_release(&note);
 	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 ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help