From e97c77319728bb42d223e67cf1bf5755a80635f3 Mon Sep 17 00:00:00 2001 From: Jeanine Adkisson Date: Mon, 26 Apr 2021 12:23:42 -0400 Subject: [PATCH] Exit correctly on write errors This line (from a 9-year-old commit!) causes `alsa_in` to infinite-loop when a device is unplugged, writing `err = -11` to the standard output. It's possible `-11` could be special-cased if it represents a more specific kind of error, but the program should exit gracefully with an error code in this case. --- alsa_in.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alsa_in.c b/alsa_in.c index 8dd13c6..4418151 100644 --- a/alsa_in.c +++ b/alsa_in.c @@ -439,8 +439,8 @@ again: if( err < 0 ) { printf( "err = %d\n", err ); if (xrun_recovery(alsa_handle, err) < 0) { - //printf("Write error: %s\n", snd_strerror(err)); - //exit(EXIT_FAILURE); + printf("Write error: %s\n", snd_strerror(err)); + exit(EXIT_FAILURE); } goto again; }