From 1bf14815ef66a5faaf45536b58d8912f9c8928ec Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Thu, 8 Aug 2013 16:12:55 -0700 Subject: [PATCH] terminal.c: Check if fdopen() fails If fdopen() fails we just close the fd and return, failing the copy-and-paste. Signed-off-by: Brian Lovin --- clients/terminal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clients/terminal.c b/clients/terminal.c index 32d738c8..31bcedd4 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -841,6 +841,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++) {