aboutsummaryrefslogtreecommitdiff
path: root/backend/session/direct-ipc.c
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-06-30 10:28:41 +0900
committerDominique Martinet <asmadeus@codewreck.org>2018-06-30 11:38:21 +0900
commit266898ca1f1eeabaaff3f951a17e612147153ce5 (patch)
treeaa62f2fa68f50627825e0ad7d43b64d699d17e6e /backend/session/direct-ipc.c
parent1e17f4deb6e73880fe135662a483a4fb0af690c7 (diff)
direct session backend: fix closing -1 on error
Found through static analysis
Diffstat (limited to 'backend/session/direct-ipc.c')
-rw-r--r--backend/session/direct-ipc.c4
1 files changed, 3 insertions, 1 deletions
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;