Blame SOURCES/perl-5.16.1-RT-113730-should-be-cleared-on-do-IO-error.patch

9572a7
From a3ff80c12c16886edf9acdd3d172798e50defdb3 Mon Sep 17 00:00:00 2001
9572a7
From: Eric Brine <ikegami@adaelis.com>
9572a7
Date: Mon, 18 Jun 2012 14:56:32 -0400
9572a7
Subject: [PATCH] RT#113730 - $@ should be cleared on "do" IO error.
9572a7
9572a7
---
9572a7
 pp_ctl.c  |  1 +
9572a7
 t/op/do.t | 12 ++++++++++++
9572a7
 2 files changed, 13 insertions(+)
9572a7
9572a7
diff --git a/pp_ctl.c b/pp_ctl.c
9572a7
index b414e81..437bc8f 100644
9572a7
--- a/pp_ctl.c
9572a7
+++ b/pp_ctl.c
9572a7
@@ -3928,6 +3928,7 @@ PP(pp_require)
9572a7
 	    DIE(aTHX_ "Can't locate %s", name);
9572a7
 	}
9572a7
 
9572a7
+	CLEAR_ERRSV();
9572a7
 	RETPUSHUNDEF;
9572a7
     }
9572a7
     else
9572a7
diff --git a/t/op/do.t b/t/op/do.t
9572a7
index 93d3f73..c5a5905 100644
9572a7
--- a/t/op/do.t
9572a7
+++ b/t/op/do.t
9572a7
@@ -286,4 +286,16 @@ SKIP: {
9572a7
   is($w, undef, 'do STRING does not propagate warning hints');
9572a7
 }
9572a7
 
9572a7
+# RT#113730 - $@ should be cleared on IO error.
9572a7
+{
9572a7
+    $@ = "should not see";
9572a7
+    $! = 0;
9572a7
+    my $rv = do("some nonexistent file");
9572a7
+    my $saved_error = $@;
9572a7
+    my $saved_errno = $!;
9572a7
+    ok(!$rv,          "do returns false on io errror");
9572a7
+    ok(!$saved_error, "\$\@ not set on io error");
9572a7
+    ok($saved_errno,  "\$! set on io error");
9572a7
+}
9572a7
+
9572a7
 done_testing();
9572a7
-- 
9572a7
1.7.11.4
9572a7