From f22064088b1538509e1f1f8cafd07ca3c13f00c9 Mon Sep 17 00:00:00 2001 From: Tyler Wear Date: Fri, 22 Jun 2018 09:17:05 -0700 Subject: ipacm: fix the err_type override issue Without ipacm-diag debug component, all the debug prints will have NOFILE err_type and overrides the kernel error codes. The fix is to cache it onve we got error from kernel. CRs-fixed: 2265427 Bug: 109872530 Test: VTS Test PASS. Basic live sanity with TMO Change-Id: I0cda8ae7a8075ef2f8caeead078296aa7e010e58 --- ipacm/src/IPACM_OffloadManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp index 5efe20f..571df8a 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp @@ -573,7 +573,7 @@ RET IPACM_OffloadManager::stopAllOffload() RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */) { wan_ioctl_set_data_quota quota; - int fd = -1,rc = 0; + int fd = -1, rc = 0, err_type = 0; if ((fd = open(DEVICE_NAME, O_RDWR)) < 0) { @@ -597,10 +597,10 @@ RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, ui if(rc != 0) { + err_type = errno; close(fd); - IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s rc: %d\n", strerror(errno),rc); - if (errno == ENODEV) { - IPACMDBG_H("Invalid argument.\n"); + IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s err_type: %d\n", strerror(errno), err_type); + if (err_type == ENODEV) { return FAIL_UNSUPPORTED; } else { -- cgit v1.2.3