From: Guenter Knauf Date: Tue, 9 Apr 2013 22:20:37 +0000 (+0200) Subject: Fixed lost OpenSSL output with "-t" - followup. X-Git-Tag: curl-7_30_0~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=577703495e2ed11c4470f2636fae0c84f0c03bbd;p=thirdparty%2Fcurl.git Fixed lost OpenSSL output with "-t" - followup. The previously applied patch didnt work on Windows; we cant rely on shell commands like 'echo' since they act diffently on each platform and each shell. In order to keep this script platform-independent the code must only use pure Perl. --- diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index 188c939cb4..edede42612 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -124,7 +124,7 @@ print CRT <) { print CRT ("=" x length($caname) . "\n"); if (!$opt_t) { print CRT $pem; - } - if ($opt_t) { - my $openssl_output = `echo '$pem' | $openssl x509 -md5 -fingerprint -text -inform PEM` or - die "Couldn't run openssl : $?\n"; - print CRT $openssl_output; + } else { + my $pipe = "|$openssl x509 -md5 -fingerprint -text -inform PEM"; + if (!$stdout) { + $pipe .= " >> $crt.~"; + close(CRT) or die "Couldn't close $crt.~: $!"; + } + open(TMP, $pipe) or die "Couldn't open openssl pipe: $!"; + print TMP $pem; + close(TMP) or die "Couldn't close openssl pipe: $!"; + if (!$stdout) { + open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!"; + } } print STDERR "Parsing: $caname\n" if ($opt_v); $certnum ++;