summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-21 16:31:28 +0200
committerTom Gundersen <teg@jklm.no>2014-05-21 16:31:28 +0200
commit23289745d737a57ecc040e18abadebaaf69dc8d1 (patch)
treeecdbe2ad60f1a85292cd33f709fdc24b07b066ea /src/libsystemd-network/sd-dhcp-client.c
parent04b28be1a306fd2ba454d3ee333d63df71aa3873 (diff)
sd-dhcp: rely on FIONREAD working
This fallback will anyway never get tested, so rip it out.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index ac97e00772..ba44069f66 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -1186,8 +1186,12 @@ static int client_receive_message_udp(sd_event_source *s, int fd,
assert(client);
r = ioctl(fd, FIONREAD, &buflen);
- if (r < 0 || buflen <= 0)
- buflen = sizeof(DHCPMessage) + DHCP_MIN_OPTIONS_SIZE;
+ if (r < 0)
+ return r;
+
+ if (buflen < 0)
+ /* this can't be right */
+ return -EIO;
message = malloc0(buflen);
if (!message)
@@ -1224,8 +1228,12 @@ static int client_receive_message_raw(sd_event_source *s, int fd,
assert(client);
r = ioctl(fd, FIONREAD, &buflen);
- if (r < 0 || buflen <= 0)
- buflen = sizeof(DHCPPacket) + DHCP_MIN_OPTIONS_SIZE;
+ if (r < 0)
+ return r;
+
+ if (buflen < 0)
+ /* this can't be right */
+ return -EIO;
packet = malloc0(buflen);
if (!packet)