From 780983923128f14e30cdd2ec07ca6e19262282b8 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 20 Dec 2009 19:46:05 +0100 Subject: [PATCH 1/1] recv_pattern(): Improve error diagnostics. It is good to know the string that was received, or the reason why nothing was received. --- net.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net.c b/net.c index 61f50dd7..00844d73 100644 --- a/net.c +++ b/net.c @@ -838,10 +838,11 @@ int recv_pattern(int fd, const char *pattern, size_t bufsize) ret = 1; out: if (ret < 0) { - PARA_NOTICE_LOG("n = %d, did not receive pattern '%s'\n", n, - pattern); + PARA_NOTICE_LOG("did not receive pattern '%s'\n", pattern); if (n > 0) - PARA_NOTICE_LOG("recvd: %s\n", buf); + PARA_NOTICE_LOG("recvd %d bytes: %s\n", n, buf); + else if (n < 0) + PARA_NOTICE_LOG("%s\n", para_strerror(-n)); } free(buf); return ret; -- 2.39.2