From: Sebastian Lackner Subject: [1/3] server: Avoid calling close on negative value in create_console_output handler (Coverity). Message-Id: <546D6A0B.8040903@fds-team.de> Date: Thu, 20 Nov 2014 05:11:55 +0100 This patch fixes CID 211706 and CID 211707 --- server/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From f15106b2a4c191c5498342cd9436e112982aa2c6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 19 Nov 2014 19:46:03 +0100 Subject: server: Avoid calling close on negative value in create_console_output handler (Coverity). --- server/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/console.c b/server/console.c index b7f8206..c83ec01 100644 --- a/server/console.c +++ b/server/console.c @@ -1609,12 +1609,12 @@ DECL_HANDLER(create_console_output) else fd = -1; if (!(console = console_input_get( req->handle_in, FILE_WRITE_PROPERTIES ))) { - close(fd); + if (fd != -1) close( fd ); return; } if (console_input_is_bare( console ) ^ (fd != -1)) { - close( fd ); + if (fd != -1) close( fd ); release_object( console ); set_error( STATUS_INVALID_HANDLE ); return; -- 2.1.3