]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
afs: Update dummy mood assumptions to reflect the reality.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 14 Mar 2022 18:52:46 +0000 (19:52 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 23 Mar 2022 18:00:23 +0000 (19:00 +0100)
The code in afs.c assumes that loading the dummy mood always succeeds,
and this is even documented in change_current_mood(). However, this
has never been true because we call into osl library functions which
may fail for various reasons. In particular, if the server is started
without a database the attempt to load the dummy mood fails because
the audio file table does not exist.

The current code was not prepared to handle this case, and does stupid
things like storing the negative error code in *num_admissible and
returning success.

Fix this confusion by adjusting the documentation and letting
activate_mood_or_playlist() fail early. One of its callers,
init_admissible_files(), needs also be adjusted because it asserted
in its error path that the mood which failed to load was not the
dummy mood.

This is a benign bug because the most common way to hit this is
at startup on a fresh install when the database does not exist. In
this case the caller, init_admissible_files(), ignores the negative
num_admissible value.


No differences found