From 577a15292736d87c656fe884bbe14be3605f8b49 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 30 Aug 2014 12:24:52 +0200 Subject: [PATCH] sane error message when read fails Signed-off-by: John Crispin --- interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface.c b/interface.c index 7f53653..0d34e72 100644 --- a/interface.c +++ b/interface.c @@ -162,8 +162,8 @@ read_socket(struct uloop_fd *u, unsigned int events) msg.msg_controllen = sizeof(cmsg6); len = recvmsg(u->fd, &msg, flags); - if (len < 0) { - fprintf(stderr, "%s:%s[%d]\n", __FILE__, __func__, __LINE__); + if (len == -1) { + perror("read failed"); return; } for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL && ifindex == -1; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { -- 2.11.0