[PATCH weston 2/2] terminal.c: check if fdopen() fails

Brian Lovin brian.j.lovin at intel.com
Wed Aug 7 15:35:00 PDT 2013


We never verify that fdopen() succeeds in terminal_send_selection().

Signed-off-by: Brian Lovin <brian.j.lovin at intel.com>
---
 clients/terminal.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clients/terminal.c b/clients/terminal.c
index 1cc26d0..5f9ee55 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -843,6 +843,10 @@ terminal_send_selection(struct terminal *terminal, int fd)
 	int len;
 
 	fp = fdopen(fd, "w");
+	if (fp == NULL){
+		fprintf(stderr, "terminal: fdopen failed\n");
+		exit(EXIT_FAILURE);
+	}
 	for (row = 0; row < terminal->height; row++) {
 		p_row = terminal_get_row(terminal, row);
 		for (col = 0; col < terminal->width; col++) {
-- 
1.8.1.2



More information about the wayland-devel mailing list