diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-17 13:59:13 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-17 13:59:13 +0000 |
commit | 75a0c0ea96046f84540900e7a7aee49f391d200a (patch) | |
tree | df36fb2f60676deb42d3eabeebe3bbea860aea0a /src/client | |
parent | e9e2a83f8861fd4d94abf621798f9b33bd308c6c (diff) | |
download | rspamd-75a0c0ea96046f84540900e7a7aee49f391d200a.tar.gz rspamd-75a0c0ea96046f84540900e7a7aee49f391d200a.zip |
Fix return code for mime processing
Issue: #449
Reported by: @vadz
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/rspamc.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 1968aed34..5e9028079 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -1143,6 +1143,8 @@ rspamc_client_execute_cmd (struct rspamc_command *cmd, ucl_object_t *result, rspamd_fprintf (stderr, "Cannot execute %s: %e", execute, exec_err); g_error_free (exec_err); + + exit (EXIT_FAILURE); } else { children = g_list_prepend (children, GSIZE_TO_POINTER (cld)); @@ -1361,7 +1363,7 @@ rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd, gint main (gint argc, gchar **argv, gchar **env) { - gint i, start_argc, cur_req = 0, res; + gint i, start_argc, cur_req = 0, res, ret; GQueue *kwattrs; GList *cur; GPid cld; @@ -1480,6 +1482,7 @@ main (gint argc, gchar **argv, gchar **env) /* Wait for children processes */ cur = g_list_first (children); + ret = 0; while (cur) { cld = GPOINTER_TO_SIZE (cur->data); @@ -1487,6 +1490,18 @@ main (gint argc, gchar **argv, gchar **env) if (waitpid (cld, &res, 0) == -1) { fprintf (stderr, "Cannot wait for %d: %s", (gint)cld, strerror (errno)); + + ret = errno; + } + + if (ret == 0) { + /* Check return code */ + if (WIFSIGNALED (res)) { + ret = WTERMSIG (res); + } + else if (WIFEXITED (res)) { + ret = WEXITSTATUS (res); + } } cur = g_list_next (cur); @@ -1496,5 +1511,5 @@ main (gint argc, gchar **argv, gchar **env) g_list_free (children); } - return 0; + return ret; } |