File: check-write-return-value.patch

package info (click to toggle)
terminal.app 0.9.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 692 kB
  • sloc: objc: 6,715; makefile: 18
file content (22 lines) | stat: -rw-r--r-- 515 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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]);
 	}