You are making system calls in your signal handler. By convention, errno gets set by the kernel at the point the system call 'fails', ie when it is interrupted by the signal. Any system calls made inside the signal handler have the potential for altering the value of errno. system calls may change errno, whether successful or not, but the value of errno is only meaningful if the call returned a failure value. The 'easy' answer is to have your handler set $! to EINTR (or text equivalent) before ending.
While on the soapbox, let me remind you that making system calls and altering global variables from within a signal handler (except protected variables) is generally a bad idea (unless the handler is simply a cleanup before exiting). Many things that are 'thread-safe' are not 'signal-handler-safe'. It is usually better to design your code so that all the handler does is set a mutex or protected variable that is checked or waited on in the main portion of the code, or a separate thread.
fnord
In reply to Re: Errno being set to strange values when using IO::Poll
by Illuminatus
in thread Errno being set to strange values when using IO::Poll
by eest
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |