diff --git a/interfaces/kits/js/src/mod_securitylabel/security_label.h b/interfaces/kits/js/src/mod_securitylabel/security_label.h index fbac9b3104a07400e077f1d822d3a66b6f917d55..beb7c4aa13c503e0b1deec432bffd283575cfab9 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());