Thread (3 messages) flat view 3 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 3/3] write_in_full: size_t is unsigned.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:51
Subsystem: the rest · Maintainer: Linus Torvalds

It received the return value from xwrite() in a size_t variable
'written' and expected comparison with 0 would catch an error
from xwrite().

Signed-off-by: Junio C Hamano <redacted>
---
 * and this is the third bug t7207-co.sh caught.  I haven't
   bothered to look at the assembly, but I suspect the error
   return path could have been totally optimized out X-<.

 write_or_die.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/write_or_die.c b/write_or_die.c
index 046e79d..5c4bc85 100644
--- a/write_or_die.c
+++ b/write_or_die.c
@@ -23,7 +23,7 @@ int write_in_full(int fd, const void *buf, size_t count)
 	ssize_t total = 0;
 
 	while (count > 0) {
-		size_t written = xwrite(fd, p, count);
+		ssize_t written = xwrite(fd, p, count);
 		if (written < 0)
 			return -1;
 		if (!written) {
-- 
1.5.0.rc2.g8ac6-dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help