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.
I mean that in the openctl function, there are three calls to open() which, I would assume, should have the same flags. That wasn't true originally, and I hoped that Sam would correct me if I was wrong to use the same flags in all three instances.
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.)
That's true, but the O_TRUNC option shouldn't break anything, so I didn't bother to remove it.
[...] - 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.
It should, but O_APPEND is easier and probably better in the sense that every record written to a control file is supposed to be appended to the end. If the file is opened with O_APPEND, that will always be the case.
I posted a patch that would seek after filtering. You can compare the two approaches if you want to.
------------------------------------------------------- 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
