dovecot-2.2-pigeonhole: Sieve extprograms plugin: Forgot to disa...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Sun Oct 6 23:14:12 EEST 2013
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/689dbc10a7fc
changeset: 1811:689dbc10a7fc
user: Stephan Bosch <stephan at rename-it.nl>
date: Sun Oct 06 22:14:01 2013 +0200
description:
Sieve extprograms plugin: Forgot to disable the alarm() timeouts set for script execution.
This may cause later syscalls to exit with EINTR unexpectedly.
diffstat:
src/plugins/sieve-extprograms/script-client-local.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 8159c26d0a36 -r 689dbc10a7fc src/plugins/sieve-extprograms/script-client-local.c
--- a/src/plugins/sieve-extprograms/script-client-local.c Thu Sep 26 21:43:09 2013 +0200
+++ b/src/plugins/sieve-extprograms/script-client-local.c Sun Oct 06 22:14:01 2013 +0200
@@ -148,7 +148,7 @@
{
struct script_client_local *slclient =
(struct script_client_local *) sclient;
- pid_t pid = slclient->pid;
+ pid_t pid = slclient->pid, ret;
time_t runtime, timeout = 0;
int status;
@@ -169,9 +169,12 @@
/* Wait for child to exit */
force = force ||
(timeout == 0 && sclient->set->input_idle_timeout_secs > 0);
- if ( !force )
+ if ( !force ) {
alarm(timeout);
- if ( force || waitpid(pid, &status, 0) < 0 ) {
+ ret = waitpid(pid, &status, 0);
+ alarm(0);
+ }
+ if ( force || ret < 0 ) {
if ( !force && errno != EINTR ) {
i_error("waitpid(%s) failed: %m", sclient->path);
(void)kill(pid, SIGKILL);
@@ -197,7 +200,9 @@
/* Wait for it to die (give it some more time) */
alarm(5);
- if ( waitpid(pid, &status, 0) < 0 ) {
+ ret = waitpid(pid, &status, 0);
+ alarm(0);
+ if ( ret < 0 ) {
if ( errno != EINTR ) {
i_error("waitpid(%s) failed: %m", sclient->path);
(void)kill(pid, SIGKILL);
@@ -223,7 +228,7 @@
return -1;
}
}
- }
+ }
/* Evaluate child exit status */
sclient->exit_code = -1;
More information about the dovecot-cvs
mailing list