diff -Nabur sendmail-8.12.2.orig/include/sm/io.h sendmail-8.12.2/include/sm/io.h
--- sendmail-8.12.2.orig/include/sm/io.h	Sun Feb 24 14:42:46 2002
+++ sendmail-8.12.2/include/sm/io.h	Sun Feb 24 14:44:14 2002
@@ -46,6 +46,7 @@
 #define SM_IO_WHAT_ISTYPE	5
 #define SM_IO_IS_READABLE	6
 #define SM_IO_WHAT_TIMEOUT	7
+#define SM_IO_WHAT_SIZE     8
 
 /* info flags (exposed) */
 #define SM_IO_FTYPE_CREATE	1
diff -Nabur sendmail-8.12.2.orig/sendmail/bf.c sendmail-8.12.2/sendmail/bf.c
--- sendmail-8.12.2.orig/sendmail/bf.c	Sun Feb 24 14:42:46 2002
+++ sendmail-8.12.2/sendmail/bf.c	Sun Feb 24 14:45:41 2002
@@ -262,6 +262,8 @@
 	{
 	  case SM_IO_WHAT_FD:
 		return bfp->bf_disk_fd;
+      case SM_IO_WHAT_SIZE:
+        return bfp->bf_buffilled;
 	  default:
 		return -1;
 	}
diff -Nabur sendmail-8.12.2.orig/sendmail/milter.c sendmail-8.12.2/sendmail/milter.c
--- sendmail-8.12.2.orig/sendmail/milter.c	Sun Feb 24 14:42:46 2002
+++ sendmail-8.12.2/sendmail/milter.c	Sun Feb 24 14:47:30 2002
@@ -2873,20 +2873,14 @@
 		/* Reset prevchar */
 		prevchar = '\0';
 
-		/* Get the current data file information */
-		if (bitset(EF_HAS_DF, e->e_flags) && e->e_dfp != NULL)
-		{
-			int afd;
-			struct stat st;
-
-			afd = sm_io_getinfo(e->e_dfp, SM_IO_WHAT_FD, NULL);
-			if (afd > 0 && fstat(afd, &st) == 0)
-				prevsize = st.st_size;
-		}
-
 		/* truncate current data file */
 		if (sm_io_getinfo(e->e_dfp, SM_IO_WHAT_ISTYPE, BF_FILE_TYPE))
 		{
+            /* Get the current data file information */
+            prevsize = sm_io_getinfo(e->e_dfp, SM_IO_WHAT_SIZE, NULL);
+            if (prevsize < 0)
+                prevsize = 0;
+
 			if (sm_io_setinfo(e->e_dfp, SM_BF_TRUNCATE, NULL) < 0)
 			{
 				MILTER_DF_ERROR("milter_replbody: sm_io truncate %s: %s");
@@ -2896,6 +2890,13 @@
 		else
 		{
 			int err;
+            int afd;
+            struct stat st;
+
+            /* Get the current data file information */
+            afd = sm_io_getinfo(e->e_dfp, SM_IO_WHAT_FD, NULL);
+            if (afd > 0 && fstat(afd, &st) == 0)
+                prevsize = st.st_size;
 
 # if NOFTRUNCATE
 			/* XXX: Not much we can do except rewind it */
