[PATCH weston v2] terminal.c: Check if fdopen() fails
Kristian Høgsberg
hoegsberg at gmail.com
Thu Aug 8 16:24:27 PDT 2013
On Thu, Aug 08, 2013 at 04:12:55PM -0700, Brian Lovin wrote:
> If fdopen() fails we just close the fd and return, failing
> the copy-and-paste.
That's nice, thanks.
Kristian
> 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list