/[pkgs]/devel/procmail/procmail-3.22-truncate.patch
ViewVC logotype

Contents of /devel/procmail/procmail-3.22-truncate.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Tue Mar 27 12:32:20 2007 UTC (2 years, 7 months ago) by mlichvar
Branch: MAIN
CVS Tags: procmail-3_22-21_fc9, F-12-split, procmail-3_22-20_fc8, F-10-split, F-7-split, procmail-3_22-22_fc10, F-11-split, procmail-3_22-23_fc11, F-8-split, procmail-3_22-25_fc12, procmail-3_22-24_fc12, F-9-split, procmail-3_22-19_fc7, HEAD
Changes since 1.1: +5 -5 lines
File MIME type: text/x-patch
- fix description (#234098)
- spec cleanup
Resolves: #234098
1 --- procmail-3.22/src/mailfold.c.truncate 2007-03-27 13:24:05.000000000 +0200
2 +++ procmail-3.22/src/mailfold.c 2007-03-27 13:25:06.000000000 +0200
3 @@ -30,6 +30,7 @@
4
5 int logopened,rawnonl;
6 off_t lasttell;
7 +static int trunced;
8 static long lastdump;
9 static volatile int mailread; /* if the mail is completely read in already */
10 static struct dyna_array confield; /* escapes, concatenations */
11 @@ -81,6 +82,7 @@
12 long len;
13 { int i;long part;
14 lasttell=i= -1;SETerrno(EBADF);
15 + trunced=0;
16 if(s>=0)
17 { if(ft_lock(type)&&(lseek(s,(off_t)0,SEEK_END),fdlock(s)))
18 nlog("Kernel-lock failed\n");
19 @@ -120,13 +122,18 @@
20 }
21 writefin:
22 i=type!=ft_PIPE&&fsync(s)&&errno!=EINVAL; /* EINVAL => wasn't a file */
23 + if ((i||len)&&lasttell>=0)
24 + { int serrno=errno;
25 + if(!ftruncate(s,lasttell)) trunced=1;
26 + SETerrno(serrno);
27 + }
28 if(ft_lock(type))
29 { int serrno=errno; /* save any error information */
30 if(fdunlock())
31 nlog("Kernel-unlock failed\n");
32 SETerrno(serrno);
33 }
34 - i=rclose(s)||i;
35 + i=rclose(s)||i; /* if this fails, we should truncate, but it's too late */
36 } /* return an error even if nothing was to be sent */
37 return i&&!len?-1:len;
38 }
39 @@ -237,7 +244,7 @@
40 #endif
41 default:writeerr(buf);
42 }
43 - if(lasttell>=0&&!truncate(boxname,lasttell)&&(logopened||verbose))
44 + if(lasttell>=0&&trunced&&(logopened||verbose))
45 nlog("Truncated file to former size\n"); /* undo garbage */
46 ret0: return 0;
47 }

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2