summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--maildrop/alarmsleep.C6
-rw-r--r--maildrop/main.C7
-rw-r--r--maildrop/recipenode.C2
-rw-r--r--maildrop/testsuite221
4 files changed, 33 insertions, 3 deletions
diff --git a/maildrop/alarmsleep.C b/maildrop/alarmsleep.C
index 4b4074a..610258e 100644
--- a/maildrop/alarmsleep.C
+++ b/maildrop/alarmsleep.C
@@ -5,10 +5,14 @@
AlarmSleep::AlarmSleep(unsigned nseconds) : flag(0)
{
+ sigset_t ss;
+
+ sigemptyset(&ss);
+
Set(nseconds);
do
{
- sigpause(0);
+ sigsuspend(&ss);
} while (!flag);
Cancel();
}
diff --git a/maildrop/main.C b/maildrop/main.C
index df0c8ac..efc7d1f 100644
--- a/maildrop/main.C
+++ b/maildrop/main.C
@@ -983,7 +983,12 @@ int fd;
{
if (r.ParseRecipe(in) < 0)
return (EX_TEMPFAIL);
- r.ExecuteRecipe();
+ try {
+ r.ExecuteRecipe();
+ } catch (int n)
+ {
+ ::exit(0);
+ }
}
}
diff --git a/maildrop/recipenode.C b/maildrop/recipenode.C
index 031eec0..1f84d1f 100644
--- a/maildrop/recipenode.C
+++ b/maildrop/recipenode.C
@@ -866,7 +866,7 @@ RecipeNode *c;
break;
case exit:
b="EXITCODE";
- ::exit ( GetVar(b)->Int("0") );
+ throw ( GetVar(b)->Int("0") );
case foreach:
if (!firstChild || !firstChild->nextSibling ||
( firstChild->nodeType != regexpr &&
diff --git a/maildrop/testsuite2 b/maildrop/testsuite2
index ae5bbf1..a199ed6 100644
--- a/maildrop/testsuite2
+++ b/maildrop/testsuite2
@@ -322,3 +322,24 @@ else
fi
rm -f testsuite?.filter testsuite.msg
+
+rm -f testsuite.dotlock
+cat >testmd <<EOF
+dotlock "testsuite.dotlock" {
+ EXITCODE=5
+ exit
+}
+EOF
+chmod 600 testmd
+./maildrop ./testmd </dev/null
+if test $? != 5
+then
+ echo "dotlock test did not exit with the correct exit code"
+ exit 1
+fi
+if test -f testsuite.dotlock
+then
+ echo "dotlock test did not clean up after itself"
+ exit 1
+fi
+rm -f testmd