From b690b4fcc62addfa3abc4413e0c78d55b984ec71 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Wed, 6 Mar 2024 21:18:13 -0300 Subject: [PATCH] Always call hbsdcontrol_extattr_rm_attr twice. --- ext/hbsdctl.rb/hbsdctl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ext/hbsdctl.rb/hbsdctl.c b/ext/hbsdctl.rb/hbsdctl.c index ffa23be..c81c6bc 100644 --- a/ext/hbsdctl.rb/hbsdctl.c +++ b/ext/hbsdctl.rb/hbsdctl.c @@ -49,6 +49,7 @@ ffi_reset(VALUE self, VALUE rb_feature, VALUE rb_path) { VALUE rb_enable_flag, rb_disable_flag; char *enable_flag, *disable_flag, *path; + int r; rb_enable_flag = rb_funcall(rb_feature, rb_intern("enable"), 0); rb_disable_flag = rb_funcall(rb_feature, rb_intern("disable"), 0); @@ -58,12 +59,9 @@ ffi_reset(VALUE self, VALUE rb_feature, VALUE rb_path) path = RSTRING_PTR(rb_path); enable_flag = RSTRING_PTR(rb_enable_flag); disable_flag = RSTRING_PTR(rb_disable_flag); - if(hbsdcontrol_extattr_rm_attr(path, disable_flag) == 0 || - hbsdcontrol_extattr_rm_attr(path, enable_flag) == 0) { - return Qtrue; - } else { - return Qfalse; - } + r = hbsdcontrol_extattr_rm_attr(path, disable_flag); + r &= hbsdcontrol_extattr_rm_attr(path, enable_flag); + return r == 0 ? Qtrue : Qfalse; } static VALUE