From f0ce50d470379a2fafaaa20243345bc084c1ad2d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 9 Aug 2016 14:25:12 -0400 Subject: [PATCH] pimd: Remove some impossible error conditions. It is impossible that we can hit these error conditions. Remove them from the code. Signed-off-by: Donald Sharp --- pimd/pim_mroute.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index ab07cb6792..f6808feb49 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -435,27 +435,14 @@ int pim_mroute_msg(int fd, const char *buf, int buf_size) static int mroute_read_msg(int fd) { - const int msg_min_size = MAX(sizeof(struct ip), sizeof(struct igmpmsg)); - char buf[1000]; + char buf[2000]; int rd; - if (((int) sizeof(buf)) < msg_min_size) { - zlog_err("%s: fd=%d: buf size=%zu lower than msg_min=%d", - __PRETTY_FUNCTION__, fd, sizeof(buf), msg_min_size); - return -1; - } - rd = read(fd, buf, sizeof(buf)); if (rd < 0) { zlog_warn("%s: failure reading fd=%d: errno=%d: %s", __PRETTY_FUNCTION__, fd, errno, safe_strerror(errno)); - return -2; - } - - if (rd < msg_min_size) { - zlog_warn("%s: short message reading fd=%d: read=%d msg_min=%d", - __PRETTY_FUNCTION__, fd, rd, msg_min_size); - return -3; + return -1; } return pim_mroute_msg(fd, buf, rd); -- 2.39.5