From 266898ca1f1eeabaaff3f951a17e612147153ce5 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 30 Jun 2018 10:28:41 +0900 Subject: direct session backend: fix closing -1 on error Found through static analysis --- backend/session/direct-ipc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'backend/session') diff --git a/backend/session/direct-ipc.c b/backend/session/direct-ipc.c index f8ba07f7..2dd777c8 100644 --- a/backend/session/direct-ipc.c +++ b/backend/session/direct-ipc.c @@ -159,7 +159,9 @@ static void communicate(int sock) { } error: send_msg(sock, ret ? -1 : fd, &ret, sizeof(ret)); - close(fd); + if (fd >= 0) { + close(fd); + } break; -- cgit v1.2.3