repo.or.cz
/
syslinux-debian
/
hramrach.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Add memtest support.
[syslinux-debian/hramrach.git]
/
com32
/
lib
/
fwrite.c
blob
b5c1d5d8b207218e1eba0e81a430b6701d28f20b
1
/*
2
* fwrite.c
3
*/
4
5
#include <errno.h>
6
#include <unistd.h>
7
#include <stdio.h>
8
9
size_t
_fwrite
(
const void
*
buf
,
size_t
count
,
FILE
*
f
)
10
{
11
size_t
bytes
=
0
;
12
ssize_t rv
;
13
const char
*
p
=
buf
;
14
15
while
(
count
) {
16
rv
=
write
(
fileno
(
f
),
p
,
count
);
17
if
(
rv
== -
1
) {
18
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
19
continue
;
20
else
21
break
;
22
}
else if
(
rv
==
0
) {
23
break
;
24
}
25
26
p
+=
rv
;
27
bytes
+=
rv
;
28
count
-=
rv
;
29
}
30
31
return
bytes
;
32
}