Keep error from nlmsgerr as-is
The error contained in nlmsgerr is already negative, there is no need
change its sign.
Bug: 315230286
Test: Send an netlink message without CAP_AUDIT_WRITE; -EPERM is
returned.
Change-Id: I49edb016f2cbf58b1e1d301a7f9840fa755fccca
diff --git a/logd/libaudit.cpp b/logd/libaudit.cpp
index ccea0a2..a305fb7 100644
--- a/logd/libaudit.cpp
+++ b/logd/libaudit.cpp
@@ -43,9 +43,7 @@
if (rep.nlh.nlmsg_type == NLMSG_ERROR) {
audit_get_reply(fd, &rep, GET_REPLY_BLOCKING, 0);
rc = reinterpret_cast<struct nlmsgerr*>(rep.data)->error;
- if (rc) {
- return -rc;
- }
+ return rc;
}
return 0;