commit a7c906a: [Minor] Rspamadm: Do not crash when control path is not reachable

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Aug 11 08:28:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-11 09:23:57 +0100
URL: https://github.com/rspamd/rspamd/commit/a7c906a2ae3381e20d1c30a318e519c9c9310128 (HEAD -> master)

[Minor] Rspamadm: Do not crash when control path is not reachable

---
 src/rspamadm/control.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/rspamadm/control.c b/src/rspamadm/control.c
index 2cc783c66..cdc504456 100644
--- a/src/rspamadm/control.c
+++ b/src/rspamadm/control.c
@@ -233,6 +233,13 @@ rspamadm_control (gint argc, gchar **argv, const struct rspamadm_command *_cmd)
 			rspamd_control_finish_handler,
 			RSPAMD_HTTP_CLIENT_SIMPLE,
 			addr);
+
+	if (!conn) {
+		rspamd_fprintf (stderr, "cannot open connection to %s: %s\n",
+				control_path, strerror (errno));
+		exit (-errno);
+	}
+
 	msg = rspamd_http_new_message (HTTP_REQUEST);
 	msg->url = rspamd_fstring_new_init (path, strlen (path));
 


More information about the Commits mailing list