Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
libdvdread
Commits
72f87861
Commit
72f87861
authored
Nov 25, 2014
by
Evgeny Grin
Committed by
Jean-Baptiste Kempf
Dec 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix partial read handling in file_read()
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
3dbbdfb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/dvd_input.c
src/dvd_input.c
+4
-3
No files found.
src/dvd_input.c
View file @
72f87861
...
...
@@ -218,12 +218,13 @@ static int file_title(dvd_input_t dev UNUSED, int block UNUSED)
static
int
file_read
(
dvd_input_t
dev
,
void
*
buffer
,
int
blocks
,
int
flags
UNUSED
)
{
size_t
len
;
size_t
len
,
bytes
;
len
=
(
size_t
)
blocks
*
DVD_VIDEO_LB_LEN
;
bytes
=
0
;
while
(
len
>
0
)
{
ssize_t
ret
=
read
(
dev
->
fd
,
buffer
,
len
);
ssize_t
ret
=
read
(
dev
->
fd
,
((
char
*
)
buffer
)
+
bytes
,
len
);
if
(
ret
<
0
)
{
/* One of the reads failed, too bad. We won't even bother
...
...
@@ -235,7 +236,6 @@ static int file_read(dvd_input_t dev, void *buffer, int blocks,
if
(
ret
==
0
)
{
/* Nothing more to read. Return all of the whole blocks, if any.
* Adjust the file position back to the previous block boundary. */
size_t
bytes
=
(
size_t
)
blocks
*
DVD_VIDEO_LB_LEN
-
len
;
off_t
over_read
=
-
(
bytes
%
DVD_VIDEO_LB_LEN
);
off_t
pos
=
lseek
(
dev
->
fd
,
over_read
,
SEEK_CUR
);
if
(
pos
%
2048
!=
0
)
...
...
@@ -244,6 +244,7 @@ static int file_read(dvd_input_t dev, void *buffer, int blocks,
}
len
-=
ret
;
bytes
+=
ret
;
}
return
blocks
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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