rpms/procmail/devel procmail-3.22-truncate.patch, NONE, 1.1 procmail.spec, 1.18, 1.19

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 30 12:13:24 UTC 2006


Author: pvrabec

Update of /cvs/dist/rpms/procmail/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19330

Modified Files:
	procmail.spec 
Added Files:
	procmail-3.22-truncate.patch 
Log Message:
- fix truncation of mailbox when running into a disk quota or a
  full partition. Patch from Solar Designer.


procmail-3.22-truncate.patch:
 mailfold.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

--- NEW FILE procmail-3.22-truncate.patch ---
--- procmail-3.22/src/mailfold.c.truncate	2006-03-30 10:56:58.000000000 -0500
+++ procmail-3.22/src/mailfold.c	2006-03-30 11:32:19.000000000 -0500
@@ -30,6 +30,7 @@
 
 int logopened,rawnonl;
 off_t lasttell;
+static int trunced;
 static off_t lastdump;
 static volatile int mailread;	/* if the mail is completely read in already */
 static struct dyna_array confield;		  /* escapes, concatenations */
@@ -81,6 +82,7 @@
  size_t len;
 { int i;size_t part;
   lasttell=i= -1;SETerrno(EBADF);
+  trunced=0;
   if(s>=0)
    { if(ft_lock(type)&&(lseek(s,(off_t)0,SEEK_END),fdlock(s)))
 	nlog("Kernel-lock failed\n");
@@ -120,13 +122,18 @@
       }
 writefin:
      i=type!=ft_PIPE&&fsync(s)&&errno!=EINVAL;	  /* EINVAL => wasn't a file */
+     if ((i||len)&&lasttell>=0)
+      { int serrno=errno;
+	if(!ftruncate(s,lasttell)) trunced=1;
+	SETerrno(serrno);
+      }
      if(ft_lock(type))
       { int serrno=errno;		       /* save any error information */
 	if(fdunlock())
 	   nlog("Kernel-unlock failed\n");
 	SETerrno(serrno);
       }
-     i=rclose(s)||i;
+     i=rclose(s)||i; /* if this fails, we should truncate, but it's too late */
    }			   /* return an error even if nothing was to be sent */
   return i&&!len?-1:len;
 }
@@ -237,7 +244,7 @@
 #endif
 	      default:writeerr(buf);
 	    }
-	   if(lasttell>=0&&!truncate(boxname,lasttell)&&(logopened||verbose))
+	   if(lasttell>=0&&trunced&&(logopened||verbose))
 	      nlog("Truncated file to former size\n");	    /* undo garbage */
 ret0:	   return 0;
 	 }


Index: procmail.spec
===================================================================
RCS file: /cvs/dist/rpms/procmail/devel/procmail.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- procmail.spec	11 Feb 2006 05:17:08 -0000	1.18
+++ procmail.spec	30 Mar 2006 12:13:22 -0000	1.19
@@ -1,7 +1,7 @@
 Summary: The procmail mail processing program.
 Name: procmail
 Version: 3.22
-Release: 16.2.1
+Release: 17
 License: GPL or Artistic
 Group: System Environment/Daemons
 Source: ftp://ftp.procmail.org/pub/procmail/procmail-%{version}.tar.gz
@@ -11,6 +11,7 @@
 Patch1: procmail-3.15.1-man.patch
 Patch2: procmail_3.22-8.debian.patch
 Patch3: procmail-3.22-large_files.patch
+Patch4: procmail-3.22-truncate.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 
 %description
@@ -25,6 +26,7 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1 -b .largefiles
+%patch4 -p1 -b .truncate
 
 find . -type d -exec chmod 755 {} \;
 
@@ -58,6 +60,10 @@
 %{_mandir}/man[15]/*
 
 %changelog
+* Thu Mar 30 2006 Peter Vrabec <pvrabec at redhat.com> 3.22-17
+- fix truncation of mailbox when running into a disk quota or a
+  full partition. Patch from Solar Designer.
+
 * Fri Feb 10 2006 Jesse Keating <jkeating at redhat.com> - 3.22-16.2.1
 - bump again for double-long bug on ppc(64)
 




More information about the fedora-cvs-commits mailing list