From: Vsevolod Stakhov Date: Mon, 12 Nov 2018 11:30:42 +0000 (+0000) Subject: [Minor] Set proper exit code on errors in rspamc X-Git-Tag: 1.8.2~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebe9a34471e0676b5d7a222bab946edab099dd41;p=thirdparty%2Frspamd.git [Minor] Set proper exit code on errors in rspamc Issue: #2627 Closes: #2627 --- diff --git a/src/client/rspamc.c b/src/client/rspamc.c index f7fa2c24a5..7f333f9d79 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -68,6 +68,8 @@ static gchar *user_agent = "rspamc"; static GList *children; static GPatternSpec **exclude_compiled = NULL; +static gint retcode = EXIT_SUCCESS; + #define ADD_CLIENT_HEADER(o, n, v) do { \ struct rspamd_http_client_header *nh; \ nh = g_malloc (sizeof (*nh)); \ @@ -1588,6 +1590,10 @@ rspamc_client_cb (struct rspamd_client_connection *conn, rspamd_client_destroy (conn); g_free (cbdata->filename); g_free (cbdata); + + if (err) { + retcode = EXIT_FAILURE; + } } static void @@ -2017,5 +2023,6 @@ main (gint argc, gchar **argv, gchar **env) g_pattern_spec_free (exclude_compiled[i]); } - return ret; + /* Mix retcode (return from Rspamd side) and ret (return from subprocess) */ + return ret ^ retcode; }