VirtualBox

source: vbox/trunk/src/libs/openssl-3.3.2/util/wrap.pl.in@ 108403

最後變更 在這個檔案從108403是 108206,由 vboxsync 提交於 5 週 前

openssl-3.3.2: Exported all files to OSE and removed .scm-settings ​bugref:10757

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.8 KB
 
1#! {- $config{HASHBANGPERL} -}
2
3use strict;
4use warnings;
5
6use File::Basename;
7use File::Spec::Functions;
8
9BEGIN {
10 # This method corresponds exactly to 'use OpenSSL::Util',
11 # but allows us to use a platform specific file spec.
12 require {-
13 use Cwd qw(abs_path);
14
15 "'" . abs_path(catfile($config{sourcedir},
16 'util', 'perl', 'OpenSSL', 'Util.pm')) . "'";
17 -};
18 OpenSSL::Util->import();
19}
20
21my $there = canonpath(catdir(dirname($0), updir()));
22my $std_engines = catdir($there, 'engines');
23my $std_providers = catdir($there, 'providers');
24my $std_openssl_conf = catdir($there, 'apps/openssl.cnf');
25my $unix_shlib_wrap = catfile($there, 'util/shlib_wrap.sh');
26my $std_openssl_conf_include;
27
28if ($ARGV[0] eq '-fips') {
29 $std_openssl_conf = {-
30 use Cwd qw(abs_path);
31
32 "'" . abs_path(catfile($config{sourcedir}, 'test/fips-and-base.cnf')) . "'";
33 -};
34 shift;
35
36 $std_openssl_conf_include = catdir($there, 'providers');
37}
38
39local $ENV{OPENSSL_CONF_INCLUDE} = $std_openssl_conf_include
40 if defined $std_openssl_conf_include
41 &&($ENV{OPENSSL_CONF_INCLUDE} // '') eq ''
42 && -d $std_openssl_conf_include;
43local $ENV{OPENSSL_ENGINES} = $std_engines
44 if ($ENV{OPENSSL_ENGINES} // '') eq '' && -d $std_engines;
45local $ENV{OPENSSL_MODULES} = $std_providers
46 if ($ENV{OPENSSL_MODULES} // '') eq '' && -d $std_providers;
47local $ENV{OPENSSL_CONF} = $std_openssl_conf
48 if ($ENV{OPENSSL_CONF} // '') eq '' && -f $std_openssl_conf;
49{-
50 # For VMS, we define logical names to get the libraries properly
51 # defined.
52 use File::Spec::Functions qw(rel2abs);
53
54 if ($^O eq "VMS") {
55 my $bldtop = rel2abs($config{builddir});
56 my %names =
57 map { platform->sharedname($_) => $bldtop.platform->sharedlib($_) }
58 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
59 @{$unified_info{libraries}};
60
61 foreach (sort keys %names) {
62 $OUT .= "local \$ENV\{'$_'\} = '$names{$_}';\n";
63 }
64 }
65-}
66my $use_system = 0;
67my @cmd;
68
69if ($^O eq 'VMS') {
70 # VMS needs the command to be appropriately quotified
71 @cmd = fixup_cmd(@ARGV);
72} elsif (-x $unix_shlib_wrap) {
73 @cmd = ( $unix_shlib_wrap, @ARGV );
74} else {
75 # Hope for the best
76 @cmd = ( @ARGV );
77}
78
79# The exec() statement on MSWin32 doesn't seem to give back the exit code
80# from the call, so we resort to using system() instead.
81my $waitcode = system @cmd;
82
83# According to documentation, -1 means that system() couldn't run the command,
84# otherwise, the value is similar to the Unix wait() status value
85# (exitcode << 8 | signalcode)
86die "wrap.pl: Failed to execute '", join(' ', @cmd), "': $!\n"
87 if $waitcode == -1;
88
89# When the subprocess aborted on a signal, we simply raise the same signal.
90kill(($? & 255) => $$) if ($? & 255) != 0;
91
92# If that didn't stop this script, mimic what Unix shells do, by
93# converting the signal code to an exit code by setting the high bit.
94# This only happens on Unix flavored operating systems, the others don't
95# have this sort of signaling to date, and simply leave the low byte zero.
96exit(($? & 255) | 128) if ($? & 255) != 0;
97
98# When not a signal, just shift down the subprocess exit code and use that.
99my $exitcode = $? >> 8;
100
101# For VMS, perl recommendations is to emulate what the C library exit() does
102# for all non-zero exit codes, except we set the error severity rather than
103# success.
104# Ref: https://perldoc.perl.org/perlport#exit
105# https://perldoc.perl.org/perlvms#$?
106if ($^O eq 'VMS' && $exitcode != 0) {
107 $exitcode =
108 0x35a000 # C facility code
109 + ($exitcode * 8) # shift up to make space for the 3 severity bits
110 + 2 # Severity: E(rror)
111 + 0x10000000; # bit 28 set => the shell stays silent
112}
113exit($exitcode);
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette