]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/service.c
socket-util: introduce port argument in sockaddr_port()
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 20 Dec 2016 14:10:54 +0000 (14:10 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 10 Jan 2017 15:29:04 +0000 (15:29 +0000)
commit882ac6e769c5c8d1742e49028043ba2ce691b045
tree16a5cdccb61998e723fab3b489d7aa1464933d20
parent4e0399e69b369f3d3543285592e977063cdcc014
socket-util: introduce port argument in sockaddr_port()

sockaddr_port() either returns a >= 0 port number or a negative errno.
This works for AF_INET and AF_INET6 because port ranges are only 16-bit.

In AF_VSOCK ports are 32-bit so an int cannot represent all port number
and negative errnos.  Separate the port and the return code.
src/basic/socket-util.c
src/basic/socket-util.h
src/core/service.c