]> git.alsa-project.org Git - alsa-utils.git/commitdiff
amixer: always use line buffering for (s)events HEAD master
authorAnton Khirnov <anton@khirnov.net>
Wed, 6 Aug 2025 08:28:15 +0000 (10:28 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 25 May 2026 10:15:57 +0000 (12:15 +0200)
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 <anton@khirnov.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
amixer/amixer.c

index 5ca81ff1f58ae34b0902f0a02ab0b7fc145a6693..cc71fbe1ba4767173922315386aa3649e22f6f51 100644 (file)
@@ -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;