Commit 8a92d031 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Resolve race condition: First set handler, then call alarm().

[r21851]
parent 7028fcf7
......@@ -19,8 +19,8 @@ void handler(int sig)
}
int main(int argc, char *argv[]) {
alarm(1);
signal(SIGALRM, handler);
alarm(1);
test();
printf("FAIL ENDLESS LOOP\n");
return 1;
......
......@@ -20,8 +20,8 @@ void handler(int sig)
}
int main(void) {
alarm(1);
signal(SIGALRM, handler);
alarm(1);
foo(0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment