Skip to content

Commit

Permalink
fix #797: [Linux] net_if_stats() may raise OSError for certain NIC ca…
Browse files Browse the repository at this point in the history
…rds.
  • Loading branch information
giampaolo committed Mar 29, 2016
1 parent 96305ee commit 12c7a20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Bug tracker at https://github.com/giampaolo/psutil/issues

- #800: [Linux] psutil.virtual_memory() returns a new "shared" memory field.

**Bug fixes**

- #797: [Linux] net_if_stats() may raise OSError for certain NIC cards.


4.1.0 - 2016-03-12
==================
Expand Down
7 changes: 5 additions & 2 deletions psutil/_psutil_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,11 @@ psutil_net_if_stats(PyObject* self, PyObject* args) {
speed = ethcmd.speed;
}
else {
if (errno == EOPNOTSUPP) {
// we typically get here in case of wi-fi cards
if ((errno == EOPNOTSUPP) || (errno == EINVAL)) {
// EOPNOTSUPP may occur in case of wi-fi cards.
// For EINVAL see:
// https://github.com/giampaolo/psutil/issues/797
// #issuecomment-202999532
duplex = DUPLEX_UNKNOWN;
speed = 0;
}
Expand Down

0 comments on commit 12c7a20

Please sign in to comment.