From: Richard Levitte <levitte@openssl.org>
Date: Tue, 6 Mar 2018 20:05:16 +0000 (+0100)
Subject: util/dofile.pl: only quote stuff that actually needs quoting
X-Git-Tag: OpenSSL_1_1_0h~48
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=77ba00bc3b7a1348f310ea7ce44890eb2c11899f;p=oweals%2Fopenssl.git

util/dofile.pl: only quote stuff that actually needs quoting

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5533)

(cherry picked from commit 49cd47eaababc8c57871b929080fc1357e2ad7b8)
---

diff --git a/util/dofile.pl b/util/dofile.pl
index f561e6f9a8..a8dbfa59d5 100644
--- a/util/dofile.pl
+++ b/util/dofile.pl
@@ -99,9 +99,9 @@ package main;
 # This adds quotes (") around the given string, and escapes any $, @, \,
 # " and ' by prepending a \ to them.
 sub quotify1 {
-    my $s = shift @_;
+    my $s = my $orig = shift @_;
     $s =~ s/([\$\@\\"'])/\\$1/g;
-    '"'.$s.'"';
+    $s ne $orig || $s =~ /\s/ ? '"'.$s.'"' : $s;
 }
 
 # quotify_l LIST