From 632636dba535468d8266ad44c099f1217f1e3ea5 Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Fri, 12 Feb 2021 06:52:48 +0000
Subject: [PATCH] Do not care about the server socket closing if exiting
 anyway.

---
 client.c | 6 ++++--
 file.c   | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/client.c b/client.c
index 74dc4602..5a454ffe 100644
--- a/client.c
+++ b/client.c
@@ -553,8 +553,10 @@ static void
 client_dispatch(struct imsg *imsg, __unused void *arg)
 {
 	if (imsg == NULL) {
-		client_exitreason = CLIENT_EXIT_LOST_SERVER;
-		client_exitval = 1;
+		if (!client_exitflag) {
+			client_exitreason = CLIENT_EXIT_LOST_SERVER;
+			client_exitval = 1;
+		}
 		proc_exit(client_proc);
 		return;
 	}
diff --git a/file.c b/file.c
index 8eb4e178..8f497b38 100644
--- a/file.c
+++ b/file.c
@@ -485,7 +485,7 @@ file_write_left(struct client_files *files)
 	size_t			 left;
 	int			 waiting = 0;
 
-	RB_FOREACH (cf, client_files, files) {
+	RB_FOREACH(cf, client_files, files) {
 		if (cf->event == NULL)
 			continue;
 		left = EVBUFFER_LENGTH(cf->event->output);