ph10 2005/08/01 14:51:05 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src spool_mbox.c
Log:
Use fseek() instead of fread() to skip the body file header line, so
that the code will run in Cygwin.
Revision Changes Path
1.185 +4 -0 exim/exim-doc/doc-txt/ChangeLog
1.9 +13 -1 exim/exim-src/src/spool_mbox.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -r1.184 -r1.185
--- ChangeLog 1 Aug 2005 13:28:30 -0000 1.184
+++ ChangeLog 1 Aug 2005 13:51:05 -0000 1.185
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.184 2005/08/01 13:28:30 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.185 2005/08/01 13:51:05 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -12,6 +12,10 @@
PH/01 Added support for SQLite, basic code supplied by David Woodhouse.
PH/02 Patch to exigrep to allow it to work on syslog lines.
+
+PH/03 When creating an mbox file for a virus/spam scan, use fseek() instead of
+ fread() to skip over the body file's header line, because in Cygwin the
+ header line is locked and is inaccessible.
Exim version 4.52
Index: spool_mbox.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/spool_mbox.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- spool_mbox.c 1 Jul 2005 10:49:02 -0000 1.8
+++ spool_mbox.c 1 Aug 2005 13:51:05 -0000 1.9
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/spool_mbox.c,v 1.8 2005/07/01 10:49:02 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/spool_mbox.c,v 1.9 2005/08/01 13:51:05 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -134,10 +134,22 @@
break;
};
- (void)fread(data_buffer, 1, 18, data_file);
+ /* The code used to use this line, but it doesn't work in Cygwin.
+ *
+ * (void)fread(data_buffer, 1, 18, data_file);
+ *
+ * What's happening is that spool_mbox used to use an fread to jump over the
+ * file header. That fails under Cygwin because the header is locked, but
+ * doing an fseek succeeds. We have to output the leading newline
+ * explicitly, because the one in the file is parted of the locked area.
+ */
+
+ (void)fwrite("\n", 1, 1, mbox_file);
+ (void)fseek(data_file, SPOOL_DATA_START_OFFSET, SEEK_SET);
do {
j = fread(data_buffer, 1, sizeof(data_buffer), data_file);
+
if (j > 0) {
i = fwrite(data_buffer, 1, j, mbox_file);
if (i != j) {