From a86304783f34b9a1e8cc96aa520512343d5f76f1 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 8 Mar 2024 04:23:42 -0300 Subject: [PATCH] Prefer strncmp over strcmp --- ext/hbsdctl.rb/ffi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/hbsdctl.rb/ffi.c b/ext/hbsdctl.rb/ffi.c index bd34d0d..24d7db4 100644 --- a/ext/hbsdctl.rb/ffi.c +++ b/ext/hbsdctl.rb/ffi.c @@ -87,9 +87,9 @@ ffi_status(VALUE self, VALUE rb_feature, VALUE rb_path) 2) == -1) { rb_syserr_fail(errno, "extattr_get_file"); } - if (strcmp(enable_data, disable_data) == 0) { + if (strncmp(enable_data, disable_data, 1) == 0) { return (ID2SYM(rb_intern("conflict"))); - } else if (strcmp(enable_data, "1") == 0) { + } else if (strncmp(enable_data, "1", 1) == 0) { return (ID2SYM(rb_intern("enabled"))); } else { return (ID2SYM(rb_intern("disabled")));