sane error message when read fails
authorJohn Crispin <blogic@openwrt.org>
Sat, 30 Aug 2014 10:24:52 +0000 (12:24 +0200)
committerJohn Crispin <blogic@openwrt.org>
Sat, 30 Aug 2014 10:24:52 +0000 (12:24 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
interface.c

index 7f53653ad29c5a2b918aa24bb183c82988c3e509..0d34e72fde36b579b7200ade1c1a9c7e5eb0a7f5 100644 (file)
@@ -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)) {