about summary refs log tree commit homepage
path: root/lib/yahns/sendfile_compat.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/sendfile_compat.rb')
-rw-r--r--lib/yahns/sendfile_compat.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/sendfile_compat.rb b/lib/yahns/sendfile_compat.rb
index bd79c0c..c0269e9 100644
--- a/lib/yahns/sendfile_compat.rb
+++ b/lib/yahns/sendfile_compat.rb
@@ -1,12 +1,13 @@
 # -*- encoding: binary -*-
 # Copyright (C) 2013-2015 all contributors <yahns-public@yhbt.net>
 # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+# frozen_string_literal: true
 
 module Yahns::SendfileCompat # :nodoc:
   def trysendfile(io, offset, count)
     return 0 if count == 0
     count = 0x4000 if count > 0x4000
-    buf = Thread.current[:yahns_sfbuf] ||= ''
+    buf = Thread.current[:yahns_sfbuf] ||= ''.dup
     io.pos = offset
     str = io.read(count, buf) or return # nil for EOF
     n = 0