[PATCH 3/3] write_in_full: size_t is unsigned.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 27, 2007, 01:49 UTC
- Message-ID
- <7vlkjpqlwp.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <7vbqkluzcm.fsf@assigned-by-dhcp.cox.net>
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 <junkio@cox.net> --- * 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