summaryrefslogtreecommitdiffstats
path: root/pimd/pim_mroute.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-11 02:04:02 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-24 19:51:34 +0200
commit61e99c94aeb045a0c2d3280594a39bac1b593709 (patch)
treee262385f7084dc2090e238a03a76a4b6a3d6682d /pimd/pim_mroute.c
parentpimd: Prevent NULL dereference (diff)
downloadfrr-61e99c94aeb045a0c2d3280594a39bac1b593709.tar.xz
frr-61e99c94aeb045a0c2d3280594a39bac1b593709.zip
pimd: Ensure a 0 read fails cleanly
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_mroute.c')
-rw-r--r--pimd/pim_mroute.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 70dc38c71..bd9fbcf42 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -620,7 +620,7 @@ static int mroute_read(struct thread *t)
while (cont) {
rd = read(fd, buf, sizeof(buf));
- if (rd < 0) {
+ if (rd <= 0) {
if (errno == EINTR)
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
@@ -628,8 +628,8 @@ static int mroute_read(struct thread *t)
if (PIM_DEBUG_MROUTE)
zlog_warn(
- "%s: failure reading fd=%d: errno=%d: %s",
- __PRETTY_FUNCTION__, fd, errno,
+ "%s: failure reading rd=%d: fd=%d: errno=%d: %s",
+ __PRETTY_FUNCTION__, rd, fd, errno,
safe_strerror(errno));
goto done;
}