Fix some issues near recent chomp changes.
authorViktor Dukhovni <openssl-users@dukhovni.org>
Sat, 13 Feb 2016 07:53:13 +0000 (02:53 -0500)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Sat, 13 Feb 2016 07:54:48 +0000 (02:54 -0500)
Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/CA.pl.in
crypto/perlasm/x86_64-xlate.pl
util/files.pl
util/mk1mf.pl
util/mkfiles.pl

index fbba457..f5e8e4a 100644 (file)
@@ -120,9 +120,9 @@ if ($WHAT eq '-newcert' ) {
     close OUT;
     # ask user for existing CA certificate
     print "CA certificate filename (or enter to create)\n";
-    $FILE = <STDIN>;
-    $FILE = s|\R$|| if $FILE;
-    if ($FILE) {
+    $FILE = "" unless defined($FILE = <STDIN>);
+    $FILE =~ s{\R$}{};
+    if ($FILE ne "") {
         copy_pemfile($FILE,"${CATOP}/private/$CAKEY", "PRIVATE");
         copy_pemfile($FILE,"${CATOP}/$CACERT", "CERTIFICATE");
     } else {
index a0b3bc0..0a023fb 100755 (executable)
@@ -850,7 +850,7 @@ ___
 OPTION DOTNAME
 ___
 }
-while($line=<>) {
+while(defined($line=<>)) {
 
     $line =~ s|\R$||;           # Better chomp
 
index d984196..32e7125 100755 (executable)
@@ -25,8 +25,8 @@ while (<>)
                                {
                                $b=$`; # Keep what is before the backslash
                                $o.=$b." ";
-                               $b=<>;
-                               $b =~ s|\R$||; # Better chomp
+                               $b = "" unless defined($b = <>);
+                               $b =~ s{\R$}{};
                                }
                        else
                                {
@@ -43,7 +43,7 @@ while (<>)
                }
        }
 
-$pwd=`pwd`; $pwd =~ s|\R$||;
+($pwd=`pwd`) =~ s{\R$}{};
 
 if ($sym{'TOP'} eq ".")
        {
index 3a9f0d7..f29e50b 100755 (executable)
@@ -553,8 +553,10 @@ if ($fips)
                        {
                        open (IN, "util/fipslib_path.txt") || fipslib_error();
                        $fipslibdir = <IN>;
-                       $fipslibdir =~ s|\R$||;
                        close IN;
+                       $fipslibdir = "" unless defined($fipslibdir);
+                       $fipslibdir =~ s{\R$}{};
+                       fipslib_error() if ($fipslibdir eq "");
                        }
                fips_check_files($fipslibdir,
                                "fipscanister.lib", "fipscanister.lib.sha1",
index 4fbe29a..55dfbc6 100755 (executable)
@@ -107,8 +107,8 @@ while (<IN>)
                                {
                                $b=$`;
                                $o.=$b." ";
-                               $b=<IN>;
-                               $b =~ s|\R$||;
+                               $b = "" unless defined($b = <IN>);
+                               $b =~ s{\R$}{};
                                }
                        else
                                {