Re: Issues with sndioctl -m output

From: Duncan Overbruck <mail_at_duncano.de>
Date: Sun, 06 Sep 2020 15:25:46 +0200
> diff --git a/sndioctl/sndioctl.c b/sndioctl/sndioctl.c
> index 4c4a85a..71ae298 100644
> --- a/sndioctl/sndioctl.c
> +++ b/sndioctl/sndioctl.c
> _at_@ -1014,6 +1014,7 @@ main(int argc, char **argv)
>  			perror("malloc");
>  			exit(1);
>  		}
> +		setlinebuf(stdout);
>  		for (;;) {
>  			nfds = sioctl_pollfd(hdl, pfds, POLLIN);
>  			if (nfds == 0)

It looks like setlinebuf/setvbuf behaviour is undefined
according to this comment in musl[0], glibc seems to have
the same behaviour and doesn't flush the buffer (It also
looks like it doesn't flush on following \n when changing
values of ctls).

Maybe its best to just fflush(stdout) before each sioctl_pollfd.

[0]: https://git.musl-libc.org/cgit/musl/tree/src/stdio/setvbuf.c
Received on Sun Sep 06 2020 - 15:25:46 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:49 CEST