[systemd-devel] [PATCH] python-systemd: fix is_socket_inet to cope with ports

Simon Farnsworth simon.farnsworth at onelan.co.uk
Tue Mar 31 09:43:59 PDT 2015


On Tuesday 31 March 2015 13:53:38 Zbigniew Jędrzejewski-Szmek wrote:
> On Tue, Mar 31, 2015 at 09:46:40AM +0100, Simon Farnsworth wrote:
> > Hello,
> > 
> > We've got the Easter long weekend coming up here in the UK, and I intend to
> > spend it away from the computer. Is there anything I need to fix with this
> > patch to make it acceptable to you?
> No, the patch is fine afaik. If nobody beats me to it, I'm returning from
> vacation next week and will take a look at it then.
>

Cool - I'll stay quiet, then.

Simon

> Zbyszek
> 
> > 
> > On Wednesday 25 March 2015 17:00:09 Simon Farnsworth wrote:
> > > Just a couple of trivial oversights.
> > > ---
> > >  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 65cfec7..7c5f1b2 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 1c386bb..82011ca 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)
> > > 
> > 
> 
> 
> 
> > _______________________________________________
> > systemd-devel mailing list
> > systemd-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

-- 
Simon Farnsworth
Software Engineer
ONELAN Ltd
http://www.onelan.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150331/f1525713/attachment.sig>


More information about the systemd-devel mailing list