[PATCH] prevent retries on fclose/fflush after write errors
ska-dietlibc at skarnet.org
Tue Mar 13 17:59:03 UTC 2012
> There is no reason to "protect" reads against EINTR because EINTR
> cannot happen unless the application specifically chooses for it to
> happen (by installing a non-restarting signal handler). EINTR does not
> just randomly happen.
It can, if you take the standard literally. I agree that you *should*
be able to assume that unblockable signals have SA_RESTART behaviour,
that would simplify Unix programming a whole lot. But as of today, you
can't, and I'd rather be on the safe side.
> My claim is that code doing such protection is wrong and harmful to
> begin with.
I disagree, because it has its uses. But I think we can agree that it
is wrong to do it *in the libc*. The programmer should have the choice
to handle EINTR himself.
> Think of programs that do something like:
> fgets(buf, sizeof buf, f);
SIGALRM is raised. SIGALRM isn't caught. SIGALRM kills the process,
even if it was blocking on a safe_read() function. Where's the problem?
More information about the uClibc