From 74b220efb30d8b00307ad4dd56c66206bdfccf75 Mon Sep 17 00:00:00 2001 From: ratchov Date: Wed, 3 Mar 2021 09:40:43 +0000 Subject: [PATCH] sndioctl: Flush stdout before polling If stdout is not flushed, output is not seen by programs using sndioctl through a pipe (ex. "sndioctl -m | cat" displays nothing). Patch from Erico Nogueira , idea from Duncan Overbruck --- usr.bin/sndioctl/sndioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/sndioctl/sndioctl.c b/usr.bin/sndioctl/sndioctl.c index d95eb322437..aa174e77249 100644 --- a/usr.bin/sndioctl/sndioctl.c +++ b/usr.bin/sndioctl/sndioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sndioctl.c,v 1.15 2020/06/28 05:21:39 ratchov Exp $ */ +/* $OpenBSD: sndioctl.c,v 1.16 2021/03/03 09:40:43 ratchov Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * @@ -1022,6 +1022,7 @@ main(int argc, char **argv) exit(1); } for (;;) { + fflush(stdout); nfds = sioctl_pollfd(hdl, pfds, POLLIN); if (nfds == 0) break; -- 2.20.1