diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fileutils.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb index d4213dd0be..168bef7405 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -823,16 +823,13 @@ module FileUtils # def compare_stream(a, b) bsize = fu_stream_blksize(a, b) - sa = sb = nil - while sa == sb - sa = a.read(bsize) - sb = b.read(bsize) - unless sa and sb - if sa.nil? and sb.nil? - return true - end - end - end + sa = "" + sb = "" + begin + a.read(bsize, sa) + b.read(bsize, sb) + return true if sa.empty? && sb.empty? + end while sa == sb false end module_function :compare_stream |