Does this code has logic errors?

view full story

http://stackoverflow.com – I am a newbie,please be gentle!I copied the code from a book: #include <sys/types.h> #include <signal.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> static int alarm_fired = 0; void ding(int sig) { alarm_fired = 1; } int main(int argc, char* argv[]) { pid_t pid; printf("alarm application starting\n"); pid = fork(); switch(pid) { case -1: perror("fork failed"); exit(EXIT_FAILURE); case 0: sleep(5); kill(getpid(), SIGALRM); exit(EXIT_SUCCESS); (HowTos)