]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
getpart: better handle case of file not found
authorDan Fandrich <dan@coneharvesters.com>
Wed, 29 Mar 2023 04:07:06 +0000 (21:07 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 30 Mar 2023 16:53:57 +0000 (09:53 -0700)
tests/getpart.pm

index 9a5fbe52fc90133e354c514a876b6883b2adbde9..a2c1124f67715a5e12a7f53617ef407f0fa436fd 100644 (file)
@@ -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;
 }