in reply to Strange behaviour: $! is set after successful socketpair() call
Oops, thanks for pointing this out. It looks like I approached the problem from the wrong side - instead of trying to prevent socketpair() from putting anything in $! I should have reset $! when checking its value is the only mean to check for errors.
So, it's more accurate to use the following:
$! = undef; $) = $run_gid; die "Setting egid: $!" if $!;
(e.g., put the assignment close to when you do the call which may fail)
|
|---|