projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d145144
)
write_in_full: really write in full or return error on disk full.
author
Linus Torvalds
<torvalds@osdl.org>
Thu, 11 Jan 2007 21:04:11 +0000
(13:04 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Thu, 11 Jan 2007 21:19:18 +0000
(13:19 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
write_or_die.c
patch
|
blob
|
history
diff --git
a/write_or_die.c
b/write_or_die.c
index a119e1d208445093dd1d2869729eca9435aa020e..7f99a22aed43afd8ca06d3eafef8d3e836b15107 100644
(file)
--- a/
write_or_die.c
+++ b/
write_or_die.c
@@
-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;
- e
lse
-
return written
;
+
size_t
written = xwrite(fd, p, count);
+ if (written <
0)
+ return -1;
+ if (!written) {
+ e
rrno = ENOSPC;
+
return -1
;
}
count -= written;
p += written;