[PATCH weston v2] terminal.c: Check if fdopen() fails

Brian Lovin brian.j.lovin at intel.com
Thu Aug 8 16:12:55 PDT 2013


If fdopen() fails we just close the fd and return, failing
the copy-and-paste.

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..acf7b85 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){
+		close(fd);
+		return;
+	}
 	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