fork() problem

Ian T Zimmerman
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");
    case 0:
      printf("Running in background...\n");
/* 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

More information about the Cygwin mailing list