]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Set proper exit code on errors in rspamc
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Nov 2018 11:30:42 +0000 (11:30 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Nov 2018 11:31:12 +0000 (11:31 +0000)
Issue: #2627
Closes: #2627
src/client/rspamc.c

index f7fa2c24a58b51e48f45057de7f9af871a94827c..7f333f9d79ddca5aaf92d5f45e521213e8017a9e 100644 (file)
@@ -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;
 }