ignored; rejecting here would just add complication, and it can just as
well be done later. Allow $recipients to be visible in the ACL. */
- if (acl_not_smtp_start != NULL)
+ if (acl_not_smtp_start)
{
uschar *user_msg, *log_msg;
enable_dollar_recipients = TRUE;
enable_dollar_recipients = FALSE;
}
+ /* Pause for a while waiting for input. If none received in that time,
+ close the logfile, if we had one open; then if we wait for a long-running
+ datasource (months, in one use-case) log rotation will not leave us holding
+ the file copy. */
+
+ if (!receive_timeout)
+ {
+ struct timeval t = { 30*60, 0 }; /* 30 minutess */
+ fd_set r;
+
+ FD_ZERO(&r); FD_SET(0, &r);
+ if (select(1, &r, NULL, NULL, &t) == 0) mainlog_close();
+ }
+
/* Read the data for the message. If filter_test is not FTEST_NONE, this
will just read the headers for the message, and not write anything onto the
spool. */
extern void log_close_all(void);
extern macro_item * macro_create(const uschar *, const uschar *, BOOL);
+extern void mainlog_close(void);
#ifdef WITH_CONTENT_SCAN
extern int malware(const uschar *, int);
extern int malware_in_file(uschar *);
}
+void
+mainlog_close(void)
+{
+if (mainlogfd < 0) return;
+(void)close(mainlogfd);
+mainlogfd = -1;
+mainlog_inode = 0;
+}
/*************************************************
* Write message to log file *
happening. */
if (mainlogfd >= 0)
- {
if (Ustat(mainlog_name, &statbuf) < 0 || statbuf.st_ino != mainlog_inode)
- {
- (void)close(mainlogfd);
- mainlogfd = -1;
- mainlog_inode = 0;
- }
- }
+ mainlog_close();
/* If the log is closed, open it. Then write the line. */