diff --git a/CHANGES b/CHANGES index 40d247a..df3ae2b 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,8 @@ Corrections: addresses the explicit socksport (2nd address parameter) was ignored. Thanks to Jakub FiĊĦer for reporting this bug. + Do not log simple successful write with NOTICE level. + Building: Disabling certain features during configure could break build process. diff --git a/sysutils.c b/sysutils.c index 082e845..777388f 100644 --- a/sysutils.c +++ b/sysutils.c @@ -27,6 +27,11 @@ const int one = 1; Returns <0 on unhandled error, errno valid Will only return <0 or bytes */ +/* Assuming your pipe size is 65536 - find out with: + filan -i 1 |grep F_GETPIPE_SZ |sed 's|.*\(F_GETPIPE_SZ=[1-9][0-9]*\).*|\1|' + Then we can test partial write with something like: + socat -d4 -lu -b 262144 -u /dev/zero,readbytes=262144 -,o-nonblock |{ sleep 3; wc -c; } +*/ ssize_t writefull(int fd, const void *buff, size_t bytes) { size_t writt = 0; ssize_t chk; @@ -40,16 +45,17 @@ ssize_t writefull(int fd, const void *buff, size_t bytes) { case EWOULDBLOCK: #endif Warn4("write(%d, %p, "F_Zu"): %s", fd, (const char *)buff+writt, bytes-writt, strerror(errno)); - Sleep(1); continue; + Sleep(1); + continue; default: return -1; } } else if (writt+chk < bytes) { - Warn4("write(%d, %p, "F_Zu"): only wrote "F_Zu" bytes, trying to continue (rev.direction is blocked)", + Warn4("write(%d, %p, "F_Zu"): only wrote "F_Zu" bytes, trying to continue (meanwhile, other direction is blocked)", fd, (const char *)buff+writt, bytes-writt, chk); writt += chk; - } else { - writt = bytes; - break; + } else if (writt == 0) { + /* First attempt, write complete - no extra message */ + return chk; } } Notice3("write(%d, %p, "F_Zu") completed", fd, (const char *)buff, bytes);