Skip to content

Commit

Permalink
#670: update HISTORY/CREDITS
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Aug 26, 2015
1 parent d8416fb commit 5821122
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,7 @@ I: 664
N: Steven Winfield
W: https://github.com/stevenwinfield
I: 672

N: sk6249
W: https://github.com/sk6249
I: 670
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Bug tracker at https://github.com/giampaolo/psutil/issues

**Bug fixes**

- #670: [Windows] segfgault of net_if_addrs() in case of non-ASCII NIC names.
(patch by sk6249)
- #672: [Windows] compilation fails if using Windows SDK v8.0. (patch by
Steven Winfield)

Expand Down
35 changes: 18 additions & 17 deletions psutil/_psutil_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -2203,8 +2203,9 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
if (!py_nic_info)
goto error;

py_nic_name = PyUnicode_FromWideChar(pCurrAddresses->FriendlyName,
wcslen(pCurrAddresses->FriendlyName));
py_nic_name = PyUnicode_FromWideChar(
pCurrAddresses->FriendlyName,
wcslen(pCurrAddresses->FriendlyName));

if (py_nic_name == NULL)
goto error;
Expand Down Expand Up @@ -2850,7 +2851,7 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
PyObject *py_tuple = NULL;
PyObject *py_address = NULL;
PyObject *py_mac_address = NULL;
PyObject *py_nic_name = NULL;
PyObject *py_nic_name = NULL;

if (py_retlist == NULL)
return NULL;
Expand All @@ -2862,12 +2863,12 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {

while (pCurrAddresses) {
pUnicast = pCurrAddresses->FirstUnicastAddress;
py_nic_name = NULL;
py_nic_name = PyUnicode_FromWideChar(pCurrAddresses->FriendlyName,
wcslen(pCurrAddresses->FriendlyName));
if (py_nic_name == NULL)
goto error;

py_nic_name = NULL;
py_nic_name = PyUnicode_FromWideChar(pCurrAddresses->FriendlyName,
wcslen(pCurrAddresses->FriendlyName));
if (py_nic_name == NULL)
goto error;

// MAC address
if (pCurrAddresses->PhysicalAddressLength != 0) {
Expand Down Expand Up @@ -2971,7 +2972,7 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
pUnicast = pUnicast->Next;
}
}
Py_DECREF(py_nic_name);
Py_DECREF(py_nic_name);
pCurrAddresses = pCurrAddresses->Next;
}

Expand All @@ -2984,7 +2985,7 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
Py_DECREF(py_retlist);
Py_XDECREF(py_tuple);
Py_XDECREF(py_address);
Py_XDECREF(py_nic_name);
Py_XDECREF(py_nic_name);
return NULL;
}

Expand Down Expand Up @@ -3065,14 +3066,14 @@ psutil_net_if_stats(PyObject *self, PyObject *args) {
}

// is up?
if((pIfRow->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED ||
if((pIfRow->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED ||
pIfRow->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL) &&
pIfRow->dwAdminStatus == 1 ) {
py_is_up = Py_True;
}
else {
py_is_up = Py_False;
}
py_is_up = Py_True;
}
else {
py_is_up = Py_False;
}
Py_INCREF(py_is_up);

py_ifc_info = Py_BuildValue(
Expand Down

0 comments on commit 5821122

Please sign in to comment.