Gordon Messmer wrote: > > Sam Varshavchik wrote: > > > > I think that ctlfile should be opened for append mode. > > ...capital idea. Am I wrong to assume that all of the calls to open() > in the openctl() function should have the same flags?
I'm not sure what you mean. And I wonder what sense may have to truncate and append at the same time. (And O_TRUNC is not needed on systems where O_CREAT | O_EXCL make the open fail in case the file already exists.) > [...] > - O_WRONLY | O_TRUNC | O_CREAT | O_EXCL, > + O_WRONLY | O_TRUNC | O_CREAT | O_EXCL | O_APPEND, > PERMISSION); An lseek(fd, 0, SEEK_END) upon return from the filter should suffice. To make the question clear to all, I include an example of a cltfile I used to get the first times my filter attempted to write to it. Althought the ctlfile is flushed, its read/write pointer is not adjusted. | [EMAIL PROTECTED] | fdns; north (north.tana.it [194.243.254.162]) | e | t | M0003024A.403B5AF6.0000359B | [EMAIL PROTECTED] | R | N | E1078236505 | | p1077660505 | these 36 bytes overwrite the head of filter's output | W1077646105 | | ... tail of filter's output goes here | ... | A1077632052 | ... where the first letter on each line is the data type (as defined in comctlfile.h) N = COMCTLFILE_DSN is written by AddRecipient() that issues a sync(). E = COMCTLFILE_EXPIRES is written by closectl() after filtering. p = COMCTLFILE_FAXEXPIRES ditto W = COMCTLFILE_WARNING ditto A = COMCTLFILE_NEXTATTEMPT is not in submit2.C ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
