Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c86762a

Browse files
committed
Simplify Perl chmod calls
The Perl chmod function already takes multiple file arguments, so we don't need a separate looping function.
1 parent 119cf76 commit c86762a

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/test/ssl/ServerSetup.pm

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ sub copy_files
4343
}
4444
}
4545

46-
# Perform chmod on a set of files, taking into account wildcards
47-
sub chmod_files
48-
{
49-
my $mode = shift;
50-
my $file_expr = shift;
51-
52-
my @all_files = glob $file_expr;
53-
foreach my $file_entry (@all_files)
54-
{
55-
chmod $mode, $file_entry
56-
or die "Could not run chmod with mode $mode on $file_entry";
57-
}
58-
}
59-
6046
sub configure_test_server_for_ssl
6147
{
6248
my $tempdir = $_[0];
@@ -82,7 +68,7 @@ sub configure_test_server_for_ssl
8268
# Copy all server certificates and keys, and client root cert, to the data dir
8369
copy_files("ssl/server-*.crt", "$tempdir/pgdata");
8470
copy_files("ssl/server-*.key", "$tempdir/pgdata");
85-
chmod_files(0600, "$tempdir/pgdata/server-*.key");
71+
chmod(0600, glob "$tempdir/pgdata/server-*.key") or die $!;
8672
copy_files("ssl/root+client_ca.crt", "$tempdir/pgdata");
8773
copy_files("ssl/root+client.crl", "$tempdir/pgdata");
8874

0 commit comments

Comments
 (0)