Skip to content

Commit 9a85560

Browse files
committed
pick_random_file: pledge earlier
1 parent bb20680 commit 9a85560

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pick_random_file

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ use Getopt::Std;
2323
use Scalar::Util qw(looks_like_number);
2424
use List::Util qw(shuffle);
2525

26+
our ( $opt_h, $opt_n, $opt_v );
27+
2628
if ( $^O eq 'openbsd' ) {
2729
use OpenBSD::Pledge;
2830
sub pledge_or_die { pledge(@_) or die "Pledge failed: $!"; }
29-
}
3031

31-
our ( $opt_h, $opt_n, $opt_v );
32+
pledge_or_die(qw(rpath flock));
33+
}
3234

3335
sub usage {
3436
my $program_name = fileparse $0;
@@ -100,8 +102,6 @@ if ( defined $opt_n ) {
100102
$opt_n >= 0 or die "-n value must be greater than or equal to 0.\n";
101103
}
102104
103-
pledge_or_die(qw(rpath flock)) if $^O eq 'openbsd';
104-
105105
my @random_list_of_confs = shuffled_lines_from_input
106106
or die "Failed to shuffle lines\n";
107107

0 commit comments

Comments
 (0)