Re: [PATCH] Don't fflush(stdout) when it's not helpful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

> On Fri, 29 Jun 2007, Theodore Tso wrote:
>> 
>> Comments?
>
> Looks ok to me. 
>
> This should probably be paired up with the change to git.c (in "next") to 
> do the "fflush()" before the "ferror()" too, in case the error is pending.

Do you mean this part?

+	/* Somebody closed stdout? */
+	if (fstat(fileno(stdout), &st))
+		return 0;
+	/* Ignore write errors for pipes and sockets.. */
+	if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode))
+		return 0;
+
+	/* Check for ENOSPC and EIO errors.. */
+	if (ferror(stdout))
+		die("write failure on standard output");
+	if (fflush(stdout) || fclose(stdout))
+		die("write failure on standard output: %s", strerror(errno));
+
+	return 0;
+}

I was planning to push this out to 'master' this weekend.


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux