curl-library
[PATCH] Utils: Fix lost OpenSSL output with "-t".
From: Richard Michael <rmichael_at_edgeofthenet.org>
Date: Thu, 4 Apr 2013 11:55:21 +0200
Date: Thu, 4 Apr 2013 11:55:21 +0200
The OpenSSL pipe wrote to the final CA bundle file, but the encoded PEM
output wrote to a temporary file. Consequently, the OpenSSL output was
lost when the temp file was renamed to the final file at script finish
(overwriting the final file written earlier by openssl).
This simple fix captures openssl command output, then write to the
temporary file.
--- lib/mk-ca-bundle.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index 2eeefff..188c939 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -203,9 +203,9 @@ while (<TXT>) { print CRT $pem; } if ($opt_t) { - open(TMP, "|$openssl x509 -md5 -fingerprint -text -inform PEM >> $crt") or die "Couldn't open openssl pipe: $!\n"; - print TMP $pem; - close(TMP) or die "Couldn't close openssl pipe: $!\n"; + my $openssl_output = `echo '$pem' | $openssl x509 -md5 -fingerprint -text -inform PEM` or + die "Couldn't run openssl : $?\n"; + print CRT $openssl_output; } print STDERR "Parsing: $caname\n" if ($opt_v); $certnum ++; -- 1.8.2 ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2001-09-17