fork() is returning > 0 ???
Merlinus Ambrosius
eric at ux.acs.umn.edu
Sat Nov 10 08:48:50 AEST 1990
Can you explain why in this piece of code, fork() is returning a value
other than -1 or 0? When it works fine in other situations in the same
program? I tried changing
switch (fork ()) {
to
switch (fix = fork ()) {
where fix is declared as an int, no difference (as expected), fix does get
the pid of the child.
switch (fork ()) {
case -1:
Msg (errno, "fork");
/*NOTREACHED*/
case 0:
break;
default:
Attacher ();
/*NOTREACHED*/
}
It always ends up in the default case, which shouldn't be happening.
For now, I'm just going to stick a break in the default before it calls
Attacher(), but any ideas on what could be going on here would be wonderful.
Thanks,
Eric
--
/----------"Oh carrots are divine, you get a dozen for dime, its maaaagic."--
|Eric (the "Mentat-Philosopher") Hendrickson University of Minnesota
|eric at ux.acs.umn.edu ehend at hp370b.cfsmo.honeywell.com The game is afoot!
\---"What does 'masochist' and 'amnesia' mean? Beats me, I don't know."----
More information about the Comp.lang.c
mailing list