Broken alarm(3)
Alan Cox
alan at redhat.com
Sun Jun 12 22:41:25 UTC 2005
On Sun, Jun 12, 2005 at 02:12:04PM -0700, Chuck Forsberg WA7KGX wrote:
> I don't know when, but the alarm system call no longer works
> properly. The following program works on Unix but not
> Linux FC4t3 or FC3. This is the mechanism rz/sz use for
> generating protocol timeouts.
Your program is buggy.
> alrm(c)
> {
> longjmp(timedout, -1);
> }
Should be siglonjmp
> if (setjmp(timedout)) {
> printf("Readline:TIMEOUT\n");
> continue;
> }
and sigsetjmp
> signal(SIGALRM, alrm);
> alarm(n);
And use sigaction to get defined behaviour.
> errno = 0;
And writing to errno isn't allowed in C
> c = read(0, linbuf, 22);
> alarm(0);
Alan
More information about the fedora-test-list
mailing list