write_in_full: really write in full or return error on disk full.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
d145144c3b
commit
f6aa66cb95
@ -37,15 +37,14 @@ int write_in_full(int fd, const void *buf, size_t count)
|
||||
{
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user