only use clean buffer for failed write if sent something

Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/output.c b/lib/output.c
index 6924566..f711f2a 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -218,7 +218,7 @@
 	}
 
 	if (n < real_len) {
-		if (wsi->u.ws.clean_buffer)
+		if (n && wsi->u.ws.clean_buffer)
 			/*
 			 * This buffer unaffected by extension rewriting.
 			 * It means the user code is expected to deal with