Browse Source

hashfast: Promote problematic write() replies to warning level

Luke Dashjr 12 years ago
parent
commit
ad1d9984c6
1 changed files with 4 additions and 4 deletions
  1. 4 4
      driver-hashfast.c

+ 4 - 4
driver-hashfast.c

@@ -84,21 +84,21 @@ static
 ssize_t hashfast_write(const int fd, void * const buf, size_t bufsz)
 {
 	const ssize_t rv = write(fd, buf, bufsz);
-	if (opt_debug && opt_dev_protocol)
+	if ((opt_debug && opt_dev_protocol) || unlikely(rv != bufsz))
 	{
 		const int e = errno;
 		char hex[(bufsz * 2) + 1];
 		bin2hex(hex, buf, bufsz);
 		if (rv < 0)
-			applog(LOG_DEBUG, "%s fd=%d: SEND (%s) => %d errno=%d(%s)",
+			applog(LOG_WARNING, "%s fd=%d: SEND (%s) => %d errno=%d(%s)",
 			       "hashfast", fd, hex, (int)rv, e, bfg_strerror(e, BST_ERRNO));
 		else
 		if (rv < bufsz)
-			applog(LOG_DEBUG, "%s fd=%d: SEND %.*s(%s)",
+			applog(LOG_WARNING, "%s fd=%d: SEND %.*s(%s)",
 			       "hashfast", fd, rv * 2, hex, &hex[rv * 2]);
 		else
 		if (rv > bufsz)
-			applog(LOG_DEBUG, "%s fd=%d: SEND %s => +%d",
+			applog(LOG_WARNING, "%s fd=%d: SEND %s => +%d",
 			       "hashfast", fd, hex, (int)(rv - bufsz));
 		else
 			applog(LOG_DEBUG, "%s fd=%d: SEND %s",