summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-26 23:26:01 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-26 23:26:01 +0200
commit966d74c043098e12d4d5b101aa7650244c14b815 (patch)
treef57e14108c9d192a0a0ddb3a35709b37c9de3a8d
parente473522841f630bfd25725b06605462e5e30587f (diff)
dhcp: properly handle error from ioctl()
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c7
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;