fork() problem
Ian T Zimmerman
itz@lbin.com
Mon Aug 2 09:41:00 GMT 1999
unknown> Here's the problem... If I compile the program with this
unknown> code.. it just crashes, but if i comment this out it
unknown> compiles and runs fine even though it's not running as
unknown> it's suppose to be...
/* some code here*/
switch (fork()) {
case -1:
printf("Couldn't run in background, exiting...\n");
exit(1);
break;
case 0:
break;
default:
printf("Running in background...\n");
exit(0);
break;
}
/* other stuff*/
This is probably not the cause of your problem, but even on true POSIX
systems you're not supposed to use exit() in the default case. Use
_exit() instead.
--
Ian Zimmerman
Lightbinders, Inc.
2325 3rd Street #324, San Francisco, California 94107
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list