tech-userlevel archive

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

Re: snprintf(3) and friends async-signal safety?



In article <40e6c1df0b22de00d955dd4820d56018%helkyn.dyndns.org@localhost>,
Jean-Yves Migeon  <jeanyves.migeon%free.fr@localhost> wrote:
> Hi list,
>
> While working on my msgfmt thingy for dd(1) [1], I found that 
> snprintf(3) gets used in summary(), which is a function that can be 
> called via the SIGINFO handler.
>
> Unfortunately, I am not quite certain of what I read; a quick look at 
> snprintf(3) code in libc/stdio makes me believe that the function is 
> _not_ async signal safe (it is not listed in signal(7) either), but is 
> still used in as-is in dd(1).
>
> Question is: is it really safe to use it in a signal handler inside 
> NetBSD?

It is not and this is why we have vsnprintf_ss() but that does not handle
floating point formats.

christos



Home | Main Index | Thread Index | Old Index