in reply to Re: fork question
in thread fork question

With just the if (fork) this or that, it's really clear. What I have is

print LOG "Files and statuses" bunch of logic to figure out command if (fork()) { update a hash } else { go do the command exit }

And my raft of print statements shows that the print command is getting issued multiple times. Can't figure out how it's getting called. I can't seem to find any examples that have a bunch of stuff above the fork to see if I'm missing anything.

Replies are listed 'Best First'.
Re: Re: Re: fork question
by suaveant (Parson) on Apr 17, 2001 at 17:42 UTC
    I don't know if it would make a difference, but your print LOG line has no ; at the end of the line

    Here's what might be happening... you don't print a \n and unless you have autoflush on maybe the parent and child are both flushing to the log...
                    - Ant

      The real code isn't missing a ; I was just (sloppily :->) giving an example.

      There are no print statements in the child code (between else and exit), so somehow the child is running parent code it shouldn't even be able to see, or the parent is spawning parents, or....