Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a3be08a3
Commit
a3be08a3
authored
Apr 12, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
motionlib: fix potential file descriptor leak, set close-on-exec
parent
9526a028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
modules/control/motionlib.c
modules/control/motionlib.c
+5
-5
No files found.
modules/control/motionlib.c
View file @
a3be08a3
...
@@ -71,7 +71,7 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
...
@@ -71,7 +71,7 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
}
}
if
(
access
(
"/sys/devices/platform/hdaps/position"
,
R_OK
)
==
0
if
(
access
(
"/sys/devices/platform/hdaps/position"
,
R_OK
)
==
0
&&
(
f
=
fopen
(
"/sys/devices/platform/hdaps/calibrate"
,
"r"
)
)
)
&&
(
f
=
fopen
(
"/sys/devices/platform/hdaps/calibrate"
,
"r
e
"
)
)
)
{
{
/* IBM HDAPS support */
/* IBM HDAPS support */
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
...
@@ -86,7 +86,7 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
...
@@ -86,7 +86,7 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
msg_Dbg
(
obj
,
"AMS motion detection correctly loaded"
);
msg_Dbg
(
obj
,
"AMS motion detection correctly loaded"
);
}
}
else
if
(
access
(
"/sys/devices/platform/applesmc.768/position"
,
R_OK
)
==
0
else
if
(
access
(
"/sys/devices/platform/applesmc.768/position"
,
R_OK
)
==
0
&&
(
f
=
fopen
(
"/sys/devices/platform/applesmc.768/calibrate"
,
"r"
)
)
)
&&
(
f
=
fopen
(
"/sys/devices/platform/applesmc.768/calibrate"
,
"r
e
"
)
)
)
{
{
/* Apple SMC (newer macbooks) */
/* Apple SMC (newer macbooks) */
/* Should be factorised with HDAPS */
/* Should be factorised with HDAPS */
...
@@ -133,7 +133,7 @@ static int GetOrientation( motion_sensors_t *motion )
...
@@ -133,7 +133,7 @@ static int GetOrientation( motion_sensors_t *motion )
switch
(
motion
->
sensor
)
switch
(
motion
->
sensor
)
{
{
case
HDAPS_SENSOR
:
case
HDAPS_SENSOR
:
f
=
fopen
(
"/sys/devices/platform/hdaps/position"
,
"r"
);
f
=
fopen
(
"/sys/devices/platform/hdaps/position"
,
"r
e
"
);
if
(
!
f
)
if
(
!
f
)
{
{
return
0
;
return
0
;
...
@@ -148,7 +148,7 @@ static int GetOrientation( motion_sensors_t *motion )
...
@@ -148,7 +148,7 @@ static int GetOrientation( motion_sensors_t *motion )
return
(
i_x
-
motion
->
i_calibrate
)
*
10
;
return
(
i_x
-
motion
->
i_calibrate
)
*
10
;
case
AMS_SENSOR
:
case
AMS_SENSOR
:
f
=
fopen
(
"/sys/devices/ams/x"
,
"r"
);
f
=
fopen
(
"/sys/devices/ams/x"
,
"r
e
"
);
if
(
!
f
)
if
(
!
f
)
{
{
return
0
;
return
0
;
...
@@ -163,7 +163,7 @@ static int GetOrientation( motion_sensors_t *motion )
...
@@ -163,7 +163,7 @@ static int GetOrientation( motion_sensors_t *motion )
return
-
i_x
*
30
;
/* FIXME: arbitrary */
return
-
i_x
*
30
;
/* FIXME: arbitrary */
case
APPLESMC_SENSOR
:
case
APPLESMC_SENSOR
:
f
=
fopen
(
"/sys/devices/platform/applesmc.768/position"
,
"r"
);
f
=
fopen
(
"/sys/devices/platform/applesmc.768/position"
,
"r
e
"
);
if
(
!
f
)
if
(
!
f
)
{
{
return
0
;
return
0
;
...
...
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