diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-26 23:26:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-26 23:26:01 +0200 |
commit | 966d74c043098e12d4d5b101aa7650244c14b815 (patch) | |
tree | f57e14108c9d192a0a0ddb3a35709b37c9de3a8d | |
parent | e473522841f630bfd25725b06605462e5e30587f (diff) |
dhcp: properly handle error from ioctl()
-rw-r--r-- | src/libsystemd-network/sd-dhcp-server.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 968df1f43d..8f6da4bc00 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -901,13 +901,12 @@ static int server_receive_message(sd_event_source *s, int fd, .msg_controllen = sizeof(cmsgbuf), }; struct cmsghdr *cmsg; - int buflen = 0, len, r; + int buflen = 0, len; assert(server); - r = ioctl(fd, FIONREAD, &buflen); - if (r < 0) - return r; + if (ioctl(fd, FIONREAD, &buflen) < 0) + return -errno; if (buflen < 0) return -EIO; |