teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0167-python-systemd-fix-is_socket_inet-to-cope-with-ports.patch

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