]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: show error message if file can't be written
authorDan Fandrich <dan@coneharvesters.com>
Wed, 29 Mar 2023 21:15:16 +0000 (14:15 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 30 Mar 2023 16:53:57 +0000 (09:53 -0700)
tests/runtests.pl

index a727385a5707f59f0f367e4bf0a2f49d5d990ef9..ce547ba1907ce2c34dbf1f6b166b20c8301254df 100755 (executable)
@@ -3997,14 +3997,17 @@ sub singletest_prepare {
                     mkdir $d; # 0777
                 }
             }
-            open(my $outfile, ">", "$filename");
-            binmode $outfile; # for crapage systems, use binary
-            if($fileattr{'nonewline'}) {
-                # cut off the final newline
-                chomp($fileContent);
-            }
-            print $outfile $fileContent;
-            close($outfile);
+            if (open(my $outfile, ">", "$filename")) {
+                binmode $outfile; # for crapage systems, use binary
+                if($fileattr{'nonewline'}) {
+                    # cut off the final newline
+                    chomp($fileContent);
+                }
+                print $outfile $fileContent;
+                close($outfile);
+            } else {
+                logmsg "ERROR: cannot write $filename\n";
+            }
         }
     }
     return ($why, 0);