> Actually, plain old printf should be OK in ping.c since buffering
> is disabled for ping -f.  If you want to keep dprintf(), I think
> we can lose the setbuf() call.  Whatever you decide, it would
> be nice to make ping6.c match.

No, disagree strongly.

ping is doing this inside a signal handler.  Our snprintf has been
verified (sans floating point) for use in signal handlers.  Other
libc/stdio functions did not receive any study, because their use in a
signal handler is unacceptable.

We should never place anything like this in signal handler.  Even if
unbuffered printf is safe, someone might copy this code to elsewhere
and not pick up on the nuanced use.  Also maybe it is safe on
OpenBSD...  it surely is not elsewhere...  and people do copy our
code.

Reply via email to