dovecot-2.1: script: Set alarm() for the script being run only i...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jan 20 18:10:01 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/5f33a67d5e25
changeset: 13966:5f33a67d5e25
user: Timo Sirainen <tss at iki.fi>
date: Fri Jan 20 18:09:41 2012 +0200
description:
script: Set alarm() for the script being run only if alarm=<secs> parameter is given.
diffstat:
src/util/script.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (30 lines):
diff -r 4d60dcf35bbe -r 5f33a67d5e25 src/util/script.c
--- a/src/util/script.c Fri Jan 20 17:56:32 2012 +0200
+++ b/src/util/script.c Fri Jan 20 18:09:41 2012 +0200
@@ -78,6 +78,7 @@
/* Input contains:
VERSION .. <lf>
+ [timeout=<timeout>]
<noreply> | "-" <lf>
arg 1 <lf>
@@ -130,6 +131,7 @@
}
buffer_set_used_size(input, scanpos);
}
+ alarm(0);
/* drop the last LF */
buffer_set_used_size(input, scanpos-1);
@@ -137,6 +139,10 @@
args = t_strsplit(str_c(input), "\n");
script_verify_version(*args); args++;
if (*args != NULL) {
+ if (strncmp(*args, "alarm=", 6) == 0) {
+ alarm(atoi(*args + 6));
+ args++;
+ }
if (strcmp(*args, "noreply") == 0) {
/* no need to fork and check exit status */
exec_child(conn, args + 1);
More information about the dovecot-cvs
mailing list