Description: Check return value of `write'
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: https://savannah.nongnu.org/bugs/index.php?52619
Last-Update: 2017-12-08
---

--- terminal.app.orig/TerminalView.m
+++ terminal.app/TerminalView.m
@@ -2022,7 +2022,12 @@
 	{
 		const char *s=[d UTF8String];
 		close(pipefd[0]);
-		write(pipefd[1],s,strlen(s));
+		if (write(pipefd[1],s,strlen(s)) < 0)
+		{
+			NSLog(_(@"Unexpected error while writing."));
+			close(pipefd[1]);
+			return;
+		}
 		close(pipefd[1]);
 	}
 
