Some kernels used with ICS do not have the needed modules (quota2
with NFLOG support).
For those, we just don't allow NFLOG which will cripple quota alerts.
This is a temp workaround until kernels are prebuilts.
Change-Id: I403ba894aefb67996d791bd06055b8fec97d1407
Signed-off-by: JP Abgrall <jpa@google.com>
if ((mQuotaHandler = setupSocket(&mQuotaSock, NETLINK_NFLOG,
NFLOG_QUOTA_GROUP, NetlinkListener::NETLINK_FORMAT_BINARY)) == NULL) {
LOGE("Unable to open quota2 logging socket");
- return -1;
+ // TODO: return -1 once the emulator gets a new kernel.
}
return 0;
}
close(mRouteSock);
mRouteSock = -1;
- if (mQuotaHandler->stop()) {
- LOGE("Unable to stop quota NetlinkHandler: %s", strerror(errno));
- status = -1;
- }
+ if (mQuotaHandler) {
+ if (mQuotaHandler->stop()) {
+ LOGE("Unable to stop quota NetlinkHandler: %s", strerror(errno));
+ status = -1;
+ }
- delete mQuotaHandler;
- mQuotaHandler = NULL;
-
- close(mQuotaSock);
- mQuotaSock = -1;
+ delete mQuotaHandler;
+ mQuotaHandler = NULL;
+ close(mQuotaSock);
+ mQuotaSock = -1;
+ }
return status;
}