fehler154.c 310 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>

int foo(int x)
{
	while(x == 0)
		;

	return x;
}

int k;

void handler(int sig)
{
	printf("ok\n");
	_exit(0);
}

int main(void) {
	signal(SIGALRM, handler);
24
	alarm(1);
25
26
27
28
29
30

	foo(0);

	printf("endless loop returned!\n");
	return 1;
}