Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
86f786a2
Commit
86f786a2
authored
Mar 18, 2014
by
James Zern
Committed by
Gerrit Code Review
Mar 18, 2014
Browse files
Merge "y4minput: add more error reporting on read failure"
parents
7ae5954d
d5866987
Changes
1
Hide whitespace changes
Inline
Side-by-side
y4minput.c
View file @
86f786a2
...
...
@@ -22,13 +22,14 @@
static
int
file_read
(
void
*
buf
,
size_t
size
,
FILE
*
file
)
{
const
int
kMaxRetries
=
5
;
int
retry_count
=
0
;
int
file_error
;
size_t
len
=
0
;
do
{
const
size_t
n
=
fread
((
uint8_t
*
)
buf
+
len
,
1
,
size
-
len
,
file
);
len
+=
n
;
if
(
ferror
(
file
))
{
file_error
=
ferror
(
file
);
if
(
file_error
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
{
++
retry_count
;
clearerr
(
file
);
continue
;
}
else
{
...
...
@@ -37,7 +38,14 @@ static int file_read(void *buf, size_t size, FILE *file) {
return
0
;
}
}
}
while
(
!
feof
(
file
)
&&
len
<
size
&&
retry_count
<
kMaxRetries
);
}
while
(
!
feof
(
file
)
&&
len
<
size
&&
++
retry_count
<
kMaxRetries
);
if
(
!
feof
(
file
)
&&
len
!=
size
)
{
fprintf
(
stderr
,
"Error reading file: %u of %u bytes read,"
" error: %d, retries: %d, %d: %s
\n
"
,
(
uint32_t
)
len
,
(
uint32_t
)
size
,
file_error
,
retry_count
,
errno
,
strerror
(
errno
));
}
return
len
==
size
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment