Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: fork-bomb!

by Juerd (Abbot)
on Apr 29, 2003 at 22:10 UTC ( #254124=note: print w/ replies, xml ) Need Help??


in reply to fork-bomb!

If fork returns false, don't just assume you're the child. The returned value can be undef, which means fork failed. If you fail to check for undef, your code has very strange bugs when forking fails (which happens under heavy load, when you exceed resources, etc).

if (my $pid = fork) { # parent } elsif (defined $pid) { # child exit; } else { die $!; }
or one of the 1e6 other ways to write that.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


Comment on Re: fork-bomb!
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://254124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-26 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls