From 1e4a9554358d15dd00fbb2edeb0bf80866d7b7c4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 14 Dec 2013 02:55:33 +0000 Subject: [PATCH] scanf.rb: fix rescue modifier * lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier. a patch by Mon_Ouie at [ruby-core:52813]. [Bug #7940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/scanf.rb | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a298a58b8d..670e294076 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 14 11:55:31 2013 Nobuyoshi Nakada + + * lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier. + a patch by Mon_Ouie at [ruby-core:52813]. [Bug #7940] + Sat Dec 14 11:44:52 2013 Nobuyoshi Nakada * util.c (ruby_qsort): fix potential stack overflow on a large diff --git a/lib/scanf.rb b/lib/scanf.rb index 199eb16cce..4827df1e42 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -657,7 +657,12 @@ class IO break if fstr.last_spec fstr.prune end - seek(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE + + begin + seek(start_position + matched_so_far, IO::SEEK_SET) + rescue Errno::ESPIPE + end + soak_up_spaces if fstr.last_spec && fstr.space return final_result