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 fbba457646bb73d030d54d577f79c9296c0ecb6e..f5e8e4a191ee26201ff179382e22cf99de637966 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 a0b3bc06709dcbfaf6b56d8528749875f1e43584..0a023fb82f5b24ab61b1ff05d76688feb28e4bab 100755 (executable)
@@ -850,7 +850,7 @@ ___
 OPTION DOTNAME
 ___
 }
-while($line=<>) {
+while(defined($line=<>)) {
 
     $line =~ s|\R$||;           # Better chomp
 
index d984196616053efd2d73e23f4b07ac049ea41f66..32e712586d72bfac676f454f53ff92afa8b40ec4 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 3a9f0d76b8267f3f82ea0e570ef18943deef8890..f29e50bb776f6b80bbb54f8a33f3a063c255a9d2 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 4fbe29ac755aa84e210209507020ec1ed252721e..55dfbc64e376acd12a77adeaf3c3df7d5d4b4f4e 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
                                {