Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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 => '', plp_site => '', do_not_use => 'spamtrap' }

Comment on Re: fork-bomb!
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2015-12-01 18:55 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (25 votes), past polls