python-systemd: fix is_socket_inet to cope with ports

Just a couple of trivial oversights.
This commit is contained in:
Simon Farnsworth 2015-03-25 17:00:09 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent 776c441941
commit 9f1a574d50
2 changed files with 2 additions and 2 deletions

View file

@ -225,7 +225,7 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) {
&fd, &family, &type, &listening, &port))
return NULL;
if (port < 0 || port > INT16_MAX) {
if (port < 0 || port > UINT16_MAX) {
set_error(-EINVAL, NULL, "port must fit into uint16_t");
return NULL;
}

View file

@ -26,7 +26,7 @@ def is_socket(fileobj, family=_AF_UNSPEC, type=0, listening=-1):
def is_socket_inet(fileobj, family=_AF_UNSPEC, type=0, listening=-1, port=0):
fd = _convert_fileobj(fileobj)
return _is_socket_inet(fd, family, type, listening)
return _is_socket_inet(fd, family, type, listening, port)
def is_socket_unix(fileobj, type=0, listening=-1, path=None):
fd = _convert_fileobj(fileobj)