[vlc-devel] commit: i_fd is not applicable for Alsa so don' t try and close it if one of the Alsa routines fail. (Richard Hosking )

git version control git at videolan.org
Thu Apr 17 17:34:24 CEST 2008


vlc | branch: master | Richard Hosking <richard at hovis.net> | Thu Apr 17 16:33:14 2008 +0100| [0f79e202ee068af55a689d2aa5b4f37988080063]

i_fd is not applicable for Alsa so don't try and close it if one of the Alsa routines fail.

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

 modules/access/v4l2/v4l2.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c
index ad1dfb6..3d3cf1e 100644
--- a/modules/access/v4l2/v4l2.c
+++ b/modules/access/v4l2/v4l2.c
@@ -2259,7 +2259,6 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys,
                              bool b_demux )
 {
     char *psz_device = p_sys->psz_adev;
-    int i_fd = 0;
     p_sys->p_alsa_pcm = NULL;
     char* psz_alsa_device_name = NULL;
     snd_pcm_hw_params_t *p_hw_params = NULL;
@@ -2426,18 +2425,15 @@ static int OpenAudioDevAlsa( vlc_object_t *p_this, demux_sys_t *p_sys,
         goto adev_fail;
     }
 
-    /* Return a fake handle so other tests work */
-    i_fd = 1;
-
     free( psz_alsa_device_name );
 
     if( !p_sys->psz_adev )
         p_sys->psz_adev = strdup( ALSA_DEFAULT );
-    return i_fd;
 
- adev_fail:
+    /* Return a fake handle so other tests work */
+    return 1;
 
-    if( i_fd >= 0 ) close( i_fd );
+ adev_fail:
 
     if( p_hw_params ) snd_pcm_hw_params_free( p_hw_params );
     if( p_sys->p_alsa_pcm ) snd_pcm_close( p_sys->p_alsa_pcm );




More information about the vlc-devel mailing list