From 918183adc6459c8126322c2ddf8672b502789d73 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 3 Sep 2015 15:40:36 -0700 Subject: [PATCH] ALSA: be ready for /dev/snd to not be available If this occurs, the system has no ALSA support in the kernel, and it is appropriate for the backend to fail. closes #6 --- src/alsa.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/alsa.cpp b/src/alsa.cpp index 8e779a6..055efb0 100644 --- a/src/alsa.cpp +++ b/src/alsa.cpp @@ -1814,13 +1814,14 @@ int soundio_alsa_init(SoundIoPrivate *si) { assert(err != EFAULT); assert(err != EINVAL); assert(err != ENAMETOOLONG); - assert(err != ENOENT); destroy_alsa(si); if (err == ENOSPC) { return SoundIoErrorSystemResources; - } else { - assert(err == ENOMEM); + } else if (err == ENOMEM) { return SoundIoErrorNoMem; + } else { + // Kernel must not have ALSA support. + return SoundIoErrorInitAudioBackend; } }