Re: Broken alarm(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]