lib/ffi/stat/native.rb in ffi-libfuse-0.3.4 vs lib/ffi/stat/native.rb in ffi-libfuse-0.4.0

- old
+ new

@@ -25,17 +25,17 @@ :st_mtimespec, TimeSpec, :st_ctimespec, TimeSpec, :unused, [:long, 3] [['', :string], ['l', :string], ['f', :int]].each do |(prefix, ftype)| - native_func = "native_#{prefix}stat".to_sym - lib_func = "#{prefix}stat".to_sym + native_func = :"native_#{prefix}stat" + lib_func = :"#{prefix}stat" begin ::FFI::Stat.attach_function native_func, lib_func, [ftype, by_ref], :int rescue FFI::NotFoundError # gLibc 2.31 (Ubuntu focal) does not export these functions, it maps them to __xstat variants - native_xfunc = "native_#{prefix}xstat".to_sym - lib_xfunc = "__#{prefix}xstat".to_sym + native_xfunc = :"native_#{prefix}xstat" + lib_xfunc = :"__#{prefix}xstat" ::FFI::Stat.attach_function native_xfunc, lib_xfunc, [:int, ftype, by_ref], :int # 1 is 64 bit versions of struct stat, 3 is 32 bit ::FFI::Stat.define_singleton_method(native_func) { |file, buf| send(native_xfunc, 1, file, buf) } end end