Why is calling a standard library function inside a signal handler not recommended?
This is explained in the GNU LibC documentation .
If you call a function in a handler, make sure that it is reentrant with respect to the signals, or make sure that the signal cannot interrupt the call to the corresponding function.
And just in case, here is the Wikipedia page on reentrant functions.
, , (.. ).
, , , malloc() (, asprintf()) (.. printf()).
, , :)
man 7 signal , . POSIX.
man 7 signal
.