From: Dan Fandrich Date: Wed, 29 Mar 2023 21:15:16 +0000 (-0700) Subject: runtests: show error message if file can't be written X-Git-Tag: curl-8_1_0~241 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ced75b7cee64cdf797eaa24a76d29324029ed15;p=thirdparty%2Fcurl.git runtests: show error message if file can't be written --- diff --git a/tests/runtests.pl b/tests/runtests.pl index a727385a57..ce547ba190 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -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);