diff options
author | Phil Pennock <pdp@exim.org> | 2011-02-13 00:09:18 -0500 |
---|---|---|
committer | Phil Pennock <pdp@exim.org> | 2011-02-13 00:09:18 -0500 |
commit | 2fe767453007d1b015f52313d16dc61635085621 (patch) | |
tree | 2fd6f75261353fa40cb2b1ef26e31915b19feb84 /src | |
parent | b72aab7255159ea38ddcd7eef1051da0f07a7b8d (diff) |
Implement freeze_signal on pipe transport.
Patch from Jakob Hirsch.
fixes bug 1042
Diffstat (limited to 'src')
-rw-r--r-- | src/src/transports/pipe.c | 16 | ||||
-rw-r--r-- | src/src/transports/pipe.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 2464abd14..a681bc42d 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -41,6 +41,8 @@ optionlist pipe_transport_options[] = { (void *)offsetof(pipe_transport_options_block, escape_string) }, { "freeze_exec_fail", opt_bool, (void *)offsetof(pipe_transport_options_block, freeze_exec_fail) }, + { "freeze_signal", opt_bool, + (void *)offsetof(pipe_transport_options_block, freeze_signal) }, { "ignore_status", opt_bool, (void *)offsetof(pipe_transport_options_block, ignore_status) }, { "log_defer_output", opt_bool | opt_public, @@ -111,6 +113,7 @@ pipe_transport_options_block pipe_transport_option_defaults = { 60*60, /* timeout */ 0, /* options */ FALSE, /* freeze_exec_fail */ + FALSE, /* freeze_signal */ FALSE, /* ignore_status */ FALSE, /* permit_coredump */ FALSE, /* restrict_to_path */ @@ -960,11 +963,20 @@ if ((rc = child_close(pid, timeout)) != 0) /* Either the process completed, but yielded a non-zero (necessarily positive) status, or the process was terminated by a signal (rc will contain the negation of the signal number). Treat killing by signal as failure unless - status is being ignored. */ + status is being ignored. By default, the message is bounced back, unless + freeze_signal is set, in which case it is frozen instead. */ else if (rc < 0) { - if (!ob->ignore_status) + if (ob->freeze_signal) + { + addr->transport_return = DEFER; + addr->special_action = SPECIAL_FREEZE; + addr->message = string_sprintf("Child process of %s transport (running " + "command \"%s\") was terminated by signal %d (%s)%s", tblock->name, cmd, + -rc, os_strsignal(-rc), tmsg); + } + else if (!ob->ignore_status) { addr->transport_return = FAIL; addr->message = string_sprintf("Child process of %s transport (running " diff --git a/src/src/transports/pipe.h b/src/src/transports/pipe.h index da141c0d1..765c14092 100644 --- a/src/src/transports/pipe.h +++ b/src/src/transports/pipe.h @@ -24,6 +24,7 @@ typedef struct { int timeout; int options; BOOL freeze_exec_fail; + BOOL freeze_signal; BOOL ignore_status; BOOL permit_coredump; BOOL restrict_to_path; |