From ea5cdff6f54ac9133ee21cad61823febfc4444bb Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 1 Nov 1998 23:22:41 +0000 Subject: [PATCH] Fixed small bug in open()... --- src/control/control.c | 4 +++- src/mixer/mixer.c | 6 ++++-- src/pcm/pcm.c | 6 ++++-- src/rawmidi/rawmidi.c | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/control/control.c b/src/control/control.c index 5749ea0b..e743474e 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -50,8 +50,10 @@ int snd_ctl_open( void **handle, int card ) close( fd ); return -errno; } - if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_CTL_VERSION_MAX ) ) + if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_CTL_VERSION_MAX ) ) { + close( fd ); return -SND_ERROR_UNCOMPATIBLE_VERSION; + } ctl = (snd_ctl_t *)calloc( 1, sizeof( snd_ctl_t ) ); if ( ctl == NULL ) { close( fd ); diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index f385bc99..0e0a413a 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -29,7 +29,7 @@ #include "asoundlib.h" #define SND_FILE_MIXER "/dev/snd/mixer%i%i" -#define SND_MIXER_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 1 ) +#define SND_MIXER_VERSION_MAX SND_PROTOCOL_VERSION( 1, 1, 0 ) typedef struct { int card; @@ -51,8 +51,10 @@ int snd_mixer_open( void **handle, int card, int device ) close( fd ); return -errno; } - if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_MIXER_VERSION_MAX ) ) + if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_MIXER_VERSION_MAX ) ) { + close( fd ); return -SND_ERROR_UNCOMPATIBLE_VERSION; + } mixer = (snd_mixer_t *)calloc( 1, sizeof( snd_mixer_t ) ); if ( mixer == NULL ) { close( fd ); diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 5557f13b..a4344e4a 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -29,7 +29,7 @@ #include "asoundlib.h" #define SND_FILE_PCM "/dev/snd/pcm%i%i" -#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 0 ) +#define SND_PCM_VERSION_MAX SND_PROTOCOL_VERSION( 1, 0, 1 ) typedef struct { int card; @@ -51,8 +51,10 @@ int snd_pcm_open( void **handle, int card, int device, int mode ) close( fd ); return -errno; } - if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) + if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) { + close( fd ); return -SND_ERROR_UNCOMPATIBLE_VERSION; + } pcm = (snd_pcm_t *)calloc( 1, sizeof( snd_pcm_t ) ); if ( pcm == NULL ) { close( fd ); diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index 6a3b46ec..cb1b749d 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -51,8 +51,10 @@ int snd_rawmidi_open( void **handle, int card, int device, int mode ) close( fd ); return -errno; } - if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) + if ( SND_PROTOCOL_UNCOMPATIBLE( ver, SND_PCM_VERSION_MAX ) ) { + close( fd ); return -SND_ERROR_UNCOMPATIBLE_VERSION; + } rmidi = (snd_rawmidi_t *)calloc( 1, sizeof( snd_rawmidi_t ) ); if ( rmidi == NULL ) { close( fd ); -- 2.11.0