When you install a signal handler with signal()
, one of 2 things occur
- Most system calls get interrupted when a signal occurs, and sets errno to EINTR.
- Most system calls gets automatically restarted when a signal occurs (so they don't fail and set errno to EINTR).
Which of these 2 depends on your platform, on yours it's 2
(probably, you don't show any code that installs a signal handler.)
If you instead install a signal handler with sigaction(), you can control which behavior of 1
or 2
you want with the SA_RESTART
flag.