On 18/09/14 14:13, Reinhard Tartler wrote:
> From: Timothy Gu <[email protected]>
> 
> Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
> available.
> 
> Fixes: CID 1238992
> Signed-off-by: Timothy Gu <[email protected]>
> Signed-off-by: Michael Niedermayer <[email protected]>
> Reviewed-by: Luca Barbato <[email protected]>
> Signed-off-by: Reinhard Tartler <[email protected]>
> ---
>  libavdevice/oss_audio.c | 31 +++++++++++++++++--------------
>  1 file changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
> index ad52d78..ed5f695 100644
> --- a/libavdevice/oss_audio.c
> +++ b/libavdevice/oss_audio.c
> @@ -48,6 +48,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
>      int audio_fd;
>      int tmp, err;
>      char *flip = getenv("AUDIO_FLIP_LEFT");
> +    char errbuff[50];
>  
>      if (is_output)
>          audio_fd = avpriv_open(audio_device, O_WRONLY);
> @@ -68,8 +69,18 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
>  
>      s->frame_size = OSS_AUDIO_BLOCK_SIZE;
>  
> -    /* select format : favour native format */
> -    err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
> +#define CHECK_IOCTL_ERROR(event)                                             
>  \
> +    if (err < 0) {                                                           
>  \
> +        av_strerror(errno, errbuff, sizeof(errbuff));                        
>  \
> +        av_log(s1, AV_LOG_ERROR, #event ": %s\n", errbuff);                  
>  \
> +        goto fail;                                                           
>  \
> +    }

It can be made simpler:

if (err < 0) {
    err = AVERROR(errno);
    goto fail;
}

if the fail goto actually use err.

lu

PS: sorry for not noticing before but I'm looking at patches right
before, during and after a flight =\
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to