]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
python-systemd: fix is_socket_inet to cope with ports
authorSimon Farnsworth <simon.farnsworth@onelan.co.uk>
Wed, 25 Mar 2015 17:00:09 +0000 (17:00 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 12 Apr 2015 14:20:36 +0000 (10:20 -0400)
Just a couple of trivial oversights.

src/python-systemd/_daemon.c
src/python-systemd/daemon.py

index 65cfec7ce8a804d163f58871b11e535f38c7189e..7c5f1b2bb697f4a22b0098970e7370e8901652e7 100644 (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;
         }
index 1c386bb6fc4fbc246b869827f9daf86a84db9f45..82011ca606ff24e9544d6f953f950b05b0f62e54 100644 (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)