From aa142c5240994ce48b52141271fb22587575c11c Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 18 Mar 2012 08:36:38 +0100 Subject: [PATCH] Improve error reporting on receive path. In some error cases, no message is logged. Now we always complain loudly when an error occurs. Signed-off-by: Richard Cochran --- sk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sk.c b/sk.c index ed8065b..7dfe968 100644 --- a/sk.c +++ b/sk.c @@ -138,14 +138,17 @@ int sk_receive(int fd, void *buf, int buflen, } else if (errno == EAGAIN) { usleep(1); } else { - if (flags == MSG_ERRQUEUE) - pr_err("recvmsg tx timestamp failed: %m"); - else - pr_err("recvmsg failed: %m"); break; } } + if (cnt < 1) { + if (flags == MSG_ERRQUEUE) + pr_err("recvmsg tx timestamp failed: %m"); + else + pr_err("recvmsg failed: %m"); + } + for (cm = CMSG_FIRSTHDR(&msg); cm != NULL; cm = CMSG_NXTHDR(&msg, cm)) { level = cm->cmsg_level; type = cm->cmsg_type;