I'm using poll in my program to check if there is something to read from pipe. When there is not, poll shouldn't set POLLIN in revents. But it did this, and then when I tried to read from my pipe read returned zero which means that exactly zero bytes were read. What's going on?
Here's output from strace:
.
.
.
select(6, [4 5], NULL, NULL, NULL) = 1 (in [5])
dup2(5, 0) = 0
poll([{fd=5, events=POLLIN}], 1, 0) = 1 ([{fd=5, revents=POLLIN}])
read(5, "", 1) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=3, tv_nsec=0}, ^C{tv_sec=1, tv_nsec=251473866}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
strace: Process 45891 detached