]> git.tuebingen.mpg.de Git - paraslash.git/commit
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)
commit19c6002ccd47b720b53410d0cbbecdae6ba80223
tree423844de0dff4107f4d99f4173de20e76a722b8a
parent90b212cc7f1842f22b9ae0e1830f515eeee95ceb
afs: Update dummy mood assumptions to reflect the reality.

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.
afs.c
mood.c