From 6f4fbaf2bdd9ec7defe04bfb91e7acae6634d3f3 Mon Sep 17 00:00:00 2001 From: gwx1278443 Date: Sat, 25 Nov 2023 18:15:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E8=B0=83=E7=94=A8=20getxattr?= =?UTF-8?q?=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gwx1278443 --- interfaces/kits/js/src/mod_securitylabel/security_label.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/kits/js/src/mod_securitylabel/security_label.h b/interfaces/kits/js/src/mod_securitylabel/security_label.h index fbac9b310..beb7c4aa1 100644 --- a/interfaces/kits/js/src/mod_securitylabel/security_label.h +++ b/interfaces/kits/js/src/mod_securitylabel/security_label.h @@ -52,10 +52,10 @@ public: #else auto xattrValueSize = getxattr(path.c_str(), XATTR_KEY, nullptr, 0); #endif - if (xattrValueSize == -1 || errno == ENOTSUP) { + if (xattrValueSize == -1) { return ""; } - if (xattrValueSize <= 0) { + if (xattrValueSize == 0) { return DEFAULT_DATA_LEVEL; } std::unique_ptr xattrValue = std::make_unique((long)xattrValueSize + 1); @@ -67,10 +67,10 @@ public: #else xattrValueSize = getxattr(path.c_str(), XATTR_KEY, xattrValue.get(), xattrValueSize); #endif - if (xattrValueSize == -1 || errno == ENOTSUP) { + if (xattrValueSize == -1) { return ""; } - if (xattrValueSize <= 0) { + if (xattrValueSize == 0) { return DEFAULT_DATA_LEVEL; } return std::string(xattrValue.get()); -- Gitee