This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: fork() problem
- To: cygwin@sourceware.cygnus.com
- Subject: Re: fork() problem
- From: Ian T Zimmerman <itz@lbin.com>
- Date: 02 Aug 1999 16:38:24 +0000
- References: <19990801003028.61496.qmail@hotmail.com>
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