summaryrefslogtreecommitdiffstats
path: root/util/perl/OpenSSL/config.pm
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-03-03 14:31:35 +0100
committerRichard Levitte <levitte@openssl.org>2020-06-28 18:34:36 +0200
commit019e3a0b6b34ee0fdd8796a65ec99f5d11a2b7eb (patch)
treef39765c2e9c0d69cf421b4857efd32a9a726d8d5 /util/perl/OpenSSL/config.pm
parentconfig: Turn into a simple wrapper (diff)
downloadopenssl-019e3a0b6b34ee0fdd8796a65ec99f5d11a2b7eb.tar.xz
openssl-019e3a0b6b34ee0fdd8796a65ec99f5d11a2b7eb.zip
util/perl/OpenSSL/config.pm: remove expand() and use eval
The strings we expand contain other variable references than just ${MACHINE}. Instead of having to remember what to expand, we simply evaluate the string as a, well, string. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11230)
Diffstat (limited to '')
-rwxr-xr-xutil/perl/OpenSSL/config.pm13
1 files changed, 3 insertions, 10 deletions
diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm
index 53a77b3424..3536f12d2b 100755
--- a/util/perl/OpenSSL/config.pm
+++ b/util/perl/OpenSSL/config.pm
@@ -193,13 +193,6 @@ sub maybe_abort {
}
}
-# Expand variable references in a string.
-sub expand {
- my $var = shift;
- $var =~ s/\$\{MACHINE\}/${MACHINE}/;
- return $var;
-}
-
# Look for ISC/SCO with its unique uname program
sub is_sco_uname {
open UNAME, "uname -X 2>/dev/null|" or return '';
@@ -248,7 +241,7 @@ sub guess_system {
my $REL = is_sco_uname();
if ( $REL ne "" ) {
my $result = get_sco_type($REL);
- return expand($result) if $result ne '';
+ return eval "\"$result\"" if $result ne '';
}
# Now pattern-match
@@ -259,7 +252,7 @@ sub guess_system {
# Trailing $ omitted on purpose.
next if $sys !~ /^$pat/;
my $result = @$tuple[1];
- return expand($result);
+ return eval "\"$result\"";
}
# Complex cases.
@@ -269,7 +262,7 @@ sub guess_system {
next if $sys !~ /^$pat/;
my $ref = @$tuple[1];
my $result = &$ref;
- return expand($result);
+ return eval "\"$result\"";
}
# Oh well.