diff options
| author | Skylar Chang <chiaweic@codeaurora.org> | 2018-06-21 11:59:42 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-17 10:54:08 -0700 |
| commit | d9d752e63f3caac6fc100003948cd204be485b00 (patch) | |
| tree | 3d1f356cea7621c5725534d3ac5cdc66dd1f4b80 | |
| parent | a0b6846774c28dcd447a8392190cd1c724fbebb6 (diff) | |
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.
Bug: 109872530
Change-Id: I222f0eceaff1c2f8e5d5c71556a3a1df0c053eaa
| -rw-r--r-- | ipacm/src/IPACM_OffloadManager.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp index b8c3cf5..81bf4e3 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp @@ -576,7 +576,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) { @@ -600,9 +600,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) { + IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s err_type: %d\n", strerror(err_type), err_type); + if (err_type == ENODEV) { IPACMDBG_H("Invalid argument.\n"); return FAIL_UNSUPPORTED; } |
