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