discard.c also has some non-portable code:
tcflush (fileno(io), TCOFLUSH);
#if defined(_FSTDIO) || defined(__DragonFly__)
fpurge (io);
#else
# ifdef LINUX_STDIO
io->_IO_write_ptr = io->_IO_write_base;
# else
if ((io->_ptr = io->_base))
io->_cnt = 0;
# endif
#endif
Is the fpurge() and its emulations necessary?
discard() is called on stdout from mhl and msh in interrupt
handlers, and post but only with -debug. tcflush() should do
the purge when stdout is a terminal. If it's a file or pipe,
well, maybe some garbage could get flushed out.
And it's called on the streams that post uses to talk to its
smtp server:
kill (sm_child, SIGKILL);
discard (sm_rfp);
discard (sm_wfp);
The discard()'s after killing the child process seem unnecessary
to me.
David
_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers