From: Dan Fandrich Date: Wed, 29 Mar 2023 04:07:06 +0000 (-0700) Subject: getpart: better handle case of file not found X-Git-Tag: curl-8_1_0~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07ab5bdd3bffccd7ac00080a2bfe0cb94b16907d;p=thirdparty%2Fcurl.git getpart: better handle case of file not found --- diff --git a/tests/getpart.pm b/tests/getpart.pm index 9a5fbe52fc..a2c1124f67 100644 --- a/tests/getpart.pm +++ b/tests/getpart.pm @@ -325,11 +325,12 @@ sub loadarray { my ($filename)=@_; my @array; - open(my $temp, "<", "$filename"); - while(<$temp>) { - push @array, $_; + if (open(my $temp, "<", "$filename")) { + while(<$temp>) { + push @array, $_; + } + close($temp); } - close($temp); return @array; }