ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From bac3b41f700542d3944a2e95c7cee1681f2936f4 Mon Sep 17 00:00:00 2001
From: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Date: Wed, 25 Mar 2015 17:00:09 +0000
Subject: [PATCH] python-systemd: fix is_socket_inet to cope with ports

Just a couple of trivial oversights.

(cherry picked from commit 9f1a574d50c1ffd19f18805cc8a3a433c4f2da37)

Cherry-picked from: 81b3dd9
Resolves: #1222517
---
 src/python-systemd/_daemon.c | 2 +-
 src/python-systemd/daemon.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
index 65cfec7ce8..7c5f1b2bb6 100644
--- a/src/python-systemd/_daemon.c
+++ b/src/python-systemd/_daemon.c
@@ -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;
         }
diff --git a/src/python-systemd/daemon.py b/src/python-systemd/daemon.py
index 1c386bb6fc..82011ca606 100644
--- a/src/python-systemd/daemon.py
+++ b/src/python-systemd/daemon.py
@@ -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)