Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ce5d6635
Commit
ce5d6635
authored
Jun 12, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access_out_file: fix non-atomic write and error handling
parent
fbeaf830
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
modules/access_output/file.c
modules/access_output/file.c
+29
-10
No files found.
modules/access_output/file.c
View file @
ce5d6635
...
...
@@ -173,8 +173,13 @@ static void Close( vlc_object_t * p_this )
*****************************************************************************/
static
ssize_t
Read
(
sout_access_out_t
*
p_access
,
block_t
*
p_buffer
)
{
return
read
(
(
intptr_t
)
p_access
->
p_sys
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
ssize_t
val
;
do
val
=
read
(
(
intptr_t
)
p_access
->
p_sys
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
while
(
val
==
-
1
&&
errno
==
EINTR
);
return
val
;
}
/*****************************************************************************
...
...
@@ -186,15 +191,29 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
while
(
p_buffer
)
{
block_t
*
p_next
=
p_buffer
->
p_next
;;
i_write
+=
write
(
(
intptr_t
)
p_access
->
p_sys
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
block_Release
(
p_buffer
);
p_buffer
=
p_next
;
ssize_t
val
=
write
((
intptr_t
)
p_access
->
p_sys
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
if
(
val
==
-
1
)
{
if
(
errno
==
EINTR
)
continue
;
block_ChainRelease
(
p_buffer
);
return
-
1
;
}
if
((
size_t
)
val
>=
p_buffer
->
i_buffer
)
{
block_t
*
p_next
=
p_buffer
->
p_next
;
block_Release
(
p_buffer
);
p_buffer
=
p_next
;
}
else
{
p_buffer
->
p_buffer
+=
val
;
p_buffer
->
i_buffer
-=
val
;
}
i_write
+=
val
;
}
return
i_write
;
}
...
...
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