nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-workers] fpurge()


From: David Levine
Subject: [Nmh-workers] fpurge()
Date: Tue, 25 Dec 2012 13:17:37 -0500

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]