On Thu, 2007-12-06 at 15:29 +0100, Nicolas Boullis wrote:
I think write() can return partially written data if the other side isn't reading it fast enough. Using write_full() instead would anyway be better/safer.
I just reread my code, and I think my use of write looks safe, since only the amount that was correctly written is skipped with i_stream_skip. Do you think I'm missing something?
Oh, you're right. It's probably better that way.
Do you really need to wait for the executed process to finish? Since this is the only plugin currently creating child processes, I'd setup a SIGCHLD handler and waitpid() there to get rid of the zombie: lib_signals_set_handler(SIGCHLD, TRUE, chld_handler, NULL);
Waiting is required if we want the append to fail if the command fails. I guess it should better be a configurable option, don't you think so?
Hmm. Maybe it's good the way it is now.
One question still: would you consider merging my plugin in dovecot if I ported it to 1.1?
Yes. Although I had been thinking about also some kind of a generic "event" plugin, which would allow executing commands for different kinds of events, not just for save and copy (like flag changes). But since I'm not planning on writing that myself anytime soon, I guess save/copy would be useful enough for a lot of people.