Commits

Anonymous committed f6aa66c

write_in_full: really write in full or return error on disk full.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Comments (0)

Files changed (1)

 {
 	const char *p = buf;
 	ssize_t total = 0;
-	ssize_t written = 0;
 
 	while (count > 0) {
-		written = xwrite(fd, p, count);
-		if (written <= 0) {
-			if (total)
-				return total;
-			else
-				return written;
+		size_t written = xwrite(fd, p, count);
+		if (written < 0)
+			return -1;
+		if (!written) {
+			errno = ENOSPC;
+			return -1;
 		}
 		count -= written;
 		p += written;