valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

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

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