Search code examples
csignalsstdiosignal-handling

Should we use perror inside signal handler


should we use perror inside signal handler because they have a user space buffer like printf and other stdio functions?


Solution

  • perror is not listed in the table of async-signal-safe functions (e.g., section 2.4.3 Signal Actions) so it is not safe to call from a signal handler that may be invoked in response to a signal interrupting a non-async-signal-safe function.