diff options
author | Alastair Houghton <alastair@alastairs-place.net> | 2018-12-12 10:47:43 +0000 |
---|---|---|
committer | Alastair Houghton <alastair@alastairs-place.net> | 2018-12-12 10:47:43 +0000 |
commit | b8662eca722ee3417c433468cb6041440d0af8c9 (patch) | |
tree | ed8b8b72ec049febf51d9097e8da6fb3c1aeb558 | |
parent | fed042fd57e7213fa4663c7e7f4af343aaa72512 (diff) | |
download | netifaces-git-b8662eca722ee3417c433468cb6041440d0af8c9.tar.gz |
Fixed #26. Also fixed a couple of warnings.
-rw-r--r-- | netifaces.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/netifaces.c b/netifaces.c index 9408d73..428ea84 100644 --- a/netifaces.c +++ b/netifaces.c @@ -340,7 +340,7 @@ getnameinfo (const struct sockaddr *addr, int addr_len, static int string_from_sockaddr (struct sockaddr *addr, char *buffer, - int buflen) + size_t buflen) { struct sockaddr* bigaddr = 0; int failure; @@ -437,7 +437,7 @@ string_from_sockaddr (struct sockaddr *addr, static int string_from_netmask (struct sockaddr *addr, char *buffer, - int buflen) + size_t buflen) { #ifdef AF_INET6 if (addr && addr->sa_family == AF_INET6) { @@ -507,7 +507,7 @@ string_from_netmask (struct sockaddr *addr, sprintf (pfxbuf, "/%u", prefix); - if (bufend - bufptr > strlen(pfxbuf)) + if (bufend - bufptr > (int)strlen(pfxbuf)) strcpy (bufptr, pfxbuf); if (buflen) @@ -2073,12 +2073,12 @@ gateways (PyObject *self) } if (addr == RTA_GATEWAY) { - char buffer[256]; + char strbuf[256]; PyObject *tuple = NULL; PyObject *deftuple = NULL; - if (string_from_sockaddr (sa, buffer, sizeof(buffer)) == 0) { - PyObject *pyaddr = PyUnicode_FromString (buffer); + if (string_from_sockaddr (sa, strbuf, sizeof(strbuf)) == 0) { + PyObject *pyaddr = PyUnicode_FromString (strbuf); #ifdef RTF_IFSCOPE PyObject *isdefault = PyBool_FromLong (!(msg->rtm_flags & RTF_IFSCOPE)); #else |