afs: Improve error diagnostics.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 9 Jul 2017 11:57:47 +0000 (13:57 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 12 Aug 2017 18:18:13 +0000 (20:18 +0200)
If the given mood or playlist could not be opened, we silently switch
to the dummy mood. Let's tell the user what has happened, and why.

afs.c

diff --git a/afs.c b/afs.c
index 59595567fcd6c7b4f7c66c49bfb2e3183cd73283..fc93675a5484196ea181967ae36b5cb338222fdb 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -615,8 +615,13 @@ EXPORT_SERVER_CMD_HANDLER(select);
 
 static void init_admissible_files(const char *arg)
 {
-       if (activate_mood_or_playlist(arg, NULL) < 0)
+       int ret = activate_mood_or_playlist(arg, NULL);
+       if (ret < 0) {
+               assert(arg);
+               PARA_WARNING_LOG("could not activate %s: %s\n", arg,
+                       para_strerror(-ret));
                activate_mood_or_playlist(NULL, NULL); /* always successful */
+       }
 }
 
 static int setup_command_socket_or_die(void)