repo.or.cz
/
git
/
trast.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
missing 'static' keywords
[git/trast.git]
/
write_or_die.c
blob
ab4cb8a69cd6e54c12dac647bb5af1df54fdf6c8
1
#include
"cache.h"
2
3
void
write_or_die
(
int
fd
,
const void
*
buf
,
size_t
count
)
4
{
5
const char
*
p
=
buf
;
6
ssize_t written
;
7
8
while
(
count
>
0
) {
9
written
=
xwrite
(
fd
,
p
,
count
);
10
if
(
written
==
0
)
11
die
(
"disk full?"
);
12
else if
(
written
<
0
) {
13
if
(
errno
==
EPIPE
)
14
exit
(
0
);
15
die
(
"write error (%s)"
,
strerror
(
errno
));
16
}
17
count
-=
written
;
18
p
+=
written
;
19
}
20
}