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
7050a20a
Commit
7050a20a
authored
May 26, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
access_out_file: check file descriptor type in Open()
parent
e7a4311d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
modules/access_output/file.c
modules/access_output/file.c
+25
-6
No files found.
modules/access_output/file.c
View file @
7050a20a
...
...
@@ -110,6 +110,12 @@ static int Seek( sout_access_out_t *p_access, off_t i_pos )
return
lseek
(
(
intptr_t
)
p_access
->
p_sys
,
i_pos
,
SEEK_SET
);
}
static
int
NoSeek
(
sout_access_out_t
*
access
,
off_t
pos
)
{
(
void
)
access
;
(
void
)
pos
;
return
-
1
;
}
static
int
Control
(
sout_access_out_t
*
p_access
,
int
i_query
,
va_list
args
)
{
switch
(
i_query
)
...
...
@@ -124,11 +130,7 @@ static int Control( sout_access_out_t *p_access, int i_query, va_list args )
case
ACCESS_OUT_CAN_SEEK
:
{
bool
*
pb
=
va_arg
(
args
,
bool
*
);
struct
stat
st
;
if
(
fstat
(
(
intptr_t
)
p_access
->
p_sys
,
&
st
)
==
-
1
)
*
pb
=
false
;
else
*
pb
=
S_ISREG
(
st
.
st_mode
)
||
S_ISBLK
(
st
.
st_mode
);
*
pb
=
p_access
->
pf_seek
==
Seek
;
break
;
}
...
...
@@ -245,9 +247,26 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
struct
stat
st
;
if
(
fstat
(
fd
,
&
st
))
{
msg_Err
(
p_access
,
"write error: %s"
,
vlc_strerror_c
(
errno
));
close
(
fd
);
return
VLC_EGENERIC
;
}
p_access
->
pf_write
=
Write
;
p_access
->
pf_read
=
Read
;
p_access
->
pf_seek
=
Seek
;
if
(
S_ISREG
(
st
.
st_mode
)
||
S_ISBLK
(
st
.
st_mode
))
{
p_access
->
pf_seek
=
Seek
;
}
else
{
p_access
->
pf_seek
=
NoSeek
;
}
p_access
->
pf_control
=
Control
;
p_access
->
p_sys
=
(
void
*
)(
intptr_t
)
fd
;
...
...
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