alarm() bug in 4.2
Keith Muller
muller at sdccsu3.UUCP
Tue Jul 17 16:37:54 AEST 1984
> Fortunately, there is an easy workaround; change the previous code
> to read:
>
> for (...) {
> oldmask = sigblock(1<<SIGALRM);
> ...
> sigblock(oldmask);
> }
This won't work, this will block off SIGTERM not SIGALRM. Sigblock()
requires that to block off signal i the i-th bit in the mask must
be set. (The bits are numbered from 1 to n). So that line must read:
oldmask = sigblock(1 << (SIGALRM - 1));
Note this easily confused with select()'s mask which does NOT need to
have 1 subtracted since descriptors are numbered from 0 to n.
Keith Muller
UCSD Computer Center
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list