#include <sys/socket.h>
#if defined(CMSG_SPACE) && defined(CMSG_LEN)
-#define SEND_FD_CAPA 6
+#define SEND_FD_CAPA 10
#define SEND_FD_SPACE (SEND_FD_CAPA * sizeof(int))
union my_cmsg {
struct cmsghdr hdr;
sub which ($) {
my ($file) = @_;
return $file if index($file, '/') >= 0;
- foreach my $p (split(':', $ENV{PATH})) {
+ for my $p (split(/:/, $ENV{PATH})) {
$p .= "/$file";
return $p if -x $p;
}
sub spawn ($;$$) {
my ($cmd, $env, $opts) = @_;
- my $f = which($cmd->[0]);
- defined $f or die "$cmd->[0]: command not found\n";
+ my $f = which($cmd->[0]) // die "$cmd->[0]: command not found\n";
my @env;
$opts ||= {};
for my $child_fd (0..2) {
my $parent_fd = $opts->{$child_fd};
if (defined($parent_fd) && $parent_fd !~ /\A[0-9]+\z/) {
- defined(my $fd = fileno($parent_fd)) or
+ my $fd = fileno($parent_fd) //
die "$parent_fd not an IO GLOB? $!";
$parent_fd = $fd;
}
my $rlim = [];
foreach my $l (@RLIMITS) {
- defined(my $v = $opts->{$l}) or next;
+ my $v = $opts->{$l} // next;
my $r = eval "require BSD::Resource; BSD::Resource::$l();";
unless (defined $r) {
warn "$l undefined by BSD::Resource: $@\n";