aboutsummaryrefslogtreecommitdiff
path: root/mfd
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-12 21:55:08 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2009-03-12 21:55:08 +0000
commitc63d563fc199d3234a4ceb7dbb343ba749da7353 (patch)
treee85c2901a521bfc772801bfc4886fefcb32b21b0 /mfd
parent07336ea55b20a411f86bef4133c3a8988d229922 (diff)
downloadmailfromd-c63d563fc199d3234a4ceb7dbb343ba749da7353.tar.gz
mailfromd-c63d563fc199d3234a4ceb7dbb343ba749da7353.tar.bz2
Fix the current_message function and subprocess handling in mtasim.
* mtasim/mtasim.c (stop_mailfromd): Wait for the mailfromd child to terminate and analyze its return status. * mfd/bi_msg.m4 (bi_drop_current_message): New function. * mfd/prog.c (env_capture_start): Call bi_drop_current_message if the capture stream already exists (i.e. when starting processing 2nd or later message in a session). * mfd/msg.h (bi_drop_current_message): New prototype. * gacopyz/server.c (srv_connect): Retry attempts to connect if they fail with ECONNREFUSED. Implement 5-second timeout. * tests/testsuite.at (MAILFROMD_OPTIONS): New define. (AT_MTA_TEST): Pass MAILFROMD_OPTIONS to mtasim invocation. (AT_WITH_MAILFROMD_OPTIONS): New macro. Include curmsg.at. * tests/curmsg.at: New file * tests/etc/Makefile.am (RCFILES): Add size.rc * tests/etc/size.rc: New file git-svn-id: file:///svnroot/mailfromd/trunk@1779 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'mfd')
-rw-r--r--mfd/bi_msg.m412
-rw-r--r--mfd/msg.h1
-rw-r--r--mfd/prog.c6
3 files changed, 19 insertions, 0 deletions
diff --git a/mfd/bi_msg.m4 b/mfd/bi_msg.m4
index 5bd172c0..43882435 100644
--- a/mfd/bi_msg.m4
+++ b/mfd/bi_msg.m4
@@ -96,6 +96,18 @@ bi_get_current_message(eval_environ_t env)
return -1;
}
+void
+bi_drop_current_message(eval_environ_t env)
+{
+ int i;
+ struct mf_message *tab = MF_GET_DATA;
+ for (i = 0; i < NMSGS; i++)
+ if (tab[i].msg && tab[i].current) {
+ bi_close_message(&tab[i]);
+ break;
+ }
+}
+
m4_define([<DCL_MSG>],[<
struct mf_message *mtab = MF_GET_DATA;
diff --git a/mfd/msg.h b/mfd/msg.h
index a62ec6b2..de9b55d1 100644
--- a/mfd/msg.h
+++ b/mfd/msg.h
@@ -41,4 +41,5 @@ void bi_close_message(struct mf_message *msg);
int bi_message_register(eval_environ_t env, mu_list_t list, mu_message_t msg,
int current);
int bi_get_current_message(eval_environ_t env);
+void bi_drop_current_message(eval_environ_t env);
mu_message_t bi_message_from_descr(eval_environ_t env, int md);
diff --git a/mfd/prog.c b/mfd/prog.c
index dc5c4187..73ffffc7 100644
--- a/mfd/prog.c
+++ b/mfd/prog.c
@@ -31,6 +31,7 @@
#include <syslog.h>
#include "mailfromd.h"
#include "prog.h"
+#include "msg.h"
#include "optab.h"
#define DEFINE_BUILTIN_MODULE
#include "builtin.h"
@@ -2105,6 +2106,11 @@ env_capture_start(eval_environ_t env)
int rc;
if (env->stream) {
+ /* Drop any previously registered current message */
+ bi_drop_current_message(env);
+
+ /* Truncate existing stream and reposition to its
+ beginning */
rc = mu_stream_truncate(env->stream, 0);
if (rc == 0 && mu_stream_seek(env->stream, 0, SEEK_SET) == 0)
return 0;

Return to:

Send suggestions and report system problems to the System administrator.