[PATCH] core-util: correct error in set_nonblock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2018-02-11 at 20:12 +0100, Georg Chini wrote:
> set_nonblock() will always set the file descriptor to non-blocking,
> regardless of the nonblock argument.
> 
> This patch fixes the issue by passing the correct argument to the
> fcntl() call. The bug had no impact because there is only one caller
> of pa_make_fd_block() in poll-win32.c
> ---
>  src/pulsecore/core-util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
> index 64e9f217..7f627539 100644
> --- a/src/pulsecore/core-util.c
> +++ b/src/pulsecore/core-util.c
> @@ -202,7 +202,7 @@ static void set_nonblock(int fd, bool nonblock) {
>          nv = v & ~O_NONBLOCK;
>  
>      if (v != nv)
> -        pa_assert_se(fcntl(fd, F_SETFL, v|O_NONBLOCK) >= 0);
> +        pa_assert_se(fcntl(fd, F_SETFL, nv) >= 0);
>  
>  #elif defined(OS_IS_WIN32)
>      u_long arg;

Looks good to me.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux