[vlc-commits] v4l2: fix race condition

Rémi Denis-Courmont git at videolan.org
Wed Apr 11 22:00:51 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 11 23:00:01 2012 +0300| [61d38c8e4e3704d347696114dd12efc8cc2545ca] | committer: Rémi Denis-Courmont

v4l2: fix race condition

(regression from 855f0b7d11bd63d929cefea112a0754fdeed3618)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=61d38c8e4e3704d347696114dd12efc8cc2545ca
---

 modules/access/v4l2/access.c |    2 +-
 modules/access/v4l2/demux.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/access/v4l2/access.c b/modules/access/v4l2/access.c
index 3cd0e56..3d6a095 100644
--- a/modules/access/v4l2/access.c
+++ b/modules/access/v4l2/access.c
@@ -90,6 +90,7 @@ int AccessOpen( vlc_object_t *obj )
         /* fallback to direct kernel mode anyway */
         fd = rawfd;
     }
+    sys->fd = fd;
 
     if (InitVideo (access, fd))
     {
@@ -97,7 +98,6 @@ int AccessOpen( vlc_object_t *obj )
         goto error;
     }
 
-    sys->fd = fd;
     access->pf_seek = NULL;
     access->pf_control = AccessControl;
     return VLC_SUCCESS;
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index 7a43ba9..58e287e 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -95,6 +95,7 @@ int DemuxOpen( vlc_object_t *obj )
         /* fallback to direct kernel mode anyway */
         fd = rawfd;
     }
+    sys->fd = fd;
 
     if (InitVideo (demux, fd))
     {
@@ -102,7 +103,6 @@ int DemuxOpen( vlc_object_t *obj )
         goto error;
     }
 
-    sys->fd = fd;
     sys->controls = ControlsInit (VLC_OBJECT(demux), fd);
     demux->pf_demux = NULL;
     demux->pf_control = DemuxControl;



More information about the vlc-commits mailing list