From: Andre Noll Date: Sun, 20 Dec 2009 18:46:05 +0000 (+0100) Subject: recv_pattern(): Improve error diagnostics. X-Git-Tag: v0.4.1~5^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=780983923128f14e30cdd2ec07ca6e19262282b8;hp=1e7085d038bd66356df19c3e8a22cdeff72a0c4e recv_pattern(): Improve error diagnostics. It is good to know the string that was received, or the reason why nothing was received. --- 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;