should this work? bad practice? should i pipe between the two?
Code:static volatile sig_atomic_t init_ok = 0; ... switch (pid = fork()) { case -1: init_ok = -1; perror("Fork error!"); exit(EXIT_FAILURE); case 0: ... //do init stuff here - set init_ok to -1 if any errors ... for(;;) { init_ok = 1; //everything ok - tell parent to exit ok ... //do loop stuff ... } break; default: while(init_ok == 0) { sleep(1); } if(init_ok == 1) { exit(EXIT_SUCCESS); } else { exit(EXIT_FAILURE); } }