From: Anton Khirnov Date: Wed, 6 Aug 2025 08:28:15 +0000 (+0200) Subject: amixer: always use line buffering for (s)events X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=bcbdf24e014ec7bf17d2dd6a987fb206c6f2241e;p=alsa-utils.git amixer: always use line buffering for (s)events Line buffering is the obviously correct mode for (s)events, but block buffering would typically be used when piping its output to another program. Closes: https://github.com/alsa-project/alsa-utils/pull/306 Signed-off-by: Anton Khirnov Signed-off-by: Jaroslav Kysela --- diff --git a/amixer/amixer.c b/amixer/amixer.c index 5ca81ff..cc71fbe 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -1596,6 +1596,8 @@ static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) snd_hctl_elem_t *helem; int err; + setlinebuf(stdout); + if ((err = snd_hctl_open(&handle, card, 0)) < 0) { error("Control %s open error: %s\n", card, snd_strerror(err)); return err; @@ -1675,6 +1677,8 @@ static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) snd_mixer_t *handle; int err; + setlinebuf(stdout); + if ((err = snd_mixer_open(&handle, 0)) < 0) { error("Mixer %s open error: %s", card, snd_strerror(err)); return err;