Commits


don't loop indefinitely in ctl_connect if the server fails to start for wathever reason, we end up looping in ctl_connect indefinitely as we try to spawn the deamon (that dies) and try to connect to it. Add an arbitrary maximum number of retries before giving up. Reported by sikmir in the GitHub issue #1, thanks!


use log_warn to report the failure of canonpath


reset path buffer before writing to it otherwise path, which is filled by the garbage that's on the stack, may not end with a NUL byte. main_enqueue fails with "malformed data" if the path sent doesn't end with a NUL. (i.e. the fact that in every case the path is NUL-terminated is not relevant. For semplicity, I'm working with paths long PATH_MAX bytes and only checking that path[PATH_MAX-1] is NUL when handling the imsgs.) Issue reported by Dirk-Wilhelm Peters, thanks!


use a strictier pledge for `amused add' now that we're using canonpath instead of realpath(3), we can drop the rpath pledge promise.


use canonpath instead of realpath(3) so we get the same behaviour with `add' and `load'


use canonpath (from kern_pledge.c) instead of home grow "equivalent"


drop a local variable don't need to keep `files' around, res->files is enough. it would have prevented the previous bug (probably.)


fix `amused add' failure introduced in previous commit don't advance the files pointer, we need the original pointer when receiving the replies.


refactor: group imsg handling the approach with one-function-per-imsg leads to too much code splatted across the file.


amused monitor: allow to pass a list of event as filter it's easier / simpler for scripts to do $ amused monitor next,prev,jump rather than $ amused monitor | egrep --line-buffered 'next|prev|jump'


add back missing memzero


use a more readable strncmp to look for prefixes also while here stick an `else' before the second clausole. We're supposed to trim out only '> ' and ' ', but the missing else would also trim out ' ' after a '> '!


get rid of realpath during load it has a non-ignorable cost over NFS (sdk@ reported ~30 seconds to load 64k songs, and up to 5 minutes over wifi!) and don't provide us any real gain: files can still vanish after being imported or may appear later. The only advantage of realpath was that it would clean up the path from segments like "/./" and resolve the ".." components, but that's a minor issue anyway. prodded by, discussed with and tested by sdk@, thanks a lot!


drop now unused #include <sndio.h> with the recent refactoring, sndio is only visible in player.c


fix argc check argc can be -1 if we called noarg with argc=0, because optind is 1.