803fb7
From bac3b41f700542d3944a2e95c7cee1681f2936f4 Mon Sep 17 00:00:00 2001
803fb7
From: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
803fb7
Date: Wed, 25 Mar 2015 17:00:09 +0000
803fb7
Subject: [PATCH] python-systemd: fix is_socket_inet to cope with ports
803fb7
803fb7
Just a couple of trivial oversights.
803fb7
803fb7
(cherry picked from commit 9f1a574d50c1ffd19f18805cc8a3a433c4f2da37)
803fb7
803fb7
Cherry-picked from: 81b3dd9
803fb7
Resolves: #1222517
803fb7
---
803fb7
 src/python-systemd/_daemon.c | 2 +-
803fb7
 src/python-systemd/daemon.py | 2 +-
803fb7
 2 files changed, 2 insertions(+), 2 deletions(-)
803fb7
803fb7
diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
803fb7
index 65cfec7ce..7c5f1b2bb 100644
803fb7
--- a/src/python-systemd/_daemon.c
803fb7
+++ b/src/python-systemd/_daemon.c
803fb7
@@ -225,7 +225,7 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) {
803fb7
                               &fd, &family, &type, &listening, &port))
803fb7
                 return NULL;
803fb7
 
803fb7
-        if (port < 0 || port > INT16_MAX) {
803fb7
+        if (port < 0 || port > UINT16_MAX) {
803fb7
                 set_error(-EINVAL, NULL, "port must fit into uint16_t");
803fb7
                 return NULL;
803fb7
         }
803fb7
diff --git a/src/python-systemd/daemon.py b/src/python-systemd/daemon.py
803fb7
index 1c386bb6f..82011ca60 100644
803fb7
--- a/src/python-systemd/daemon.py
803fb7
+++ b/src/python-systemd/daemon.py
803fb7
@@ -26,7 +26,7 @@ def is_socket(fileobj, family=_AF_UNSPEC, type=0, listening=-1):
803fb7
 
803fb7
 def is_socket_inet(fileobj, family=_AF_UNSPEC, type=0, listening=-1, port=0):
803fb7
     fd = _convert_fileobj(fileobj)
803fb7
-    return _is_socket_inet(fd, family, type, listening)
803fb7
+    return _is_socket_inet(fd, family, type, listening, port)
803fb7
 
803fb7
 def is_socket_unix(fileobj, type=0, listening=-1, path=None):
803fb7
     fd = _convert_fileobj(fileobj)