commit - a7c21102d5a00f25af27b4f7ba894065aa28bb5f
commit + a975dca965d92cd6af18a82629b597668e1d69d8
blob - 65b5fdb20f1dcaf84bf7c53d54035fbbf6bafd0b
blob + 3ba1a4e03e9f2acefc5257e0a174a9a26b1ca4a8
--- amused.c
+++ amused.c
switch (imsg.hdr.type) {
case IMSG_ERR:
+ log_warnx("failed to play, skipping %s", current_song);
playlist_dropcurrent();
/* fallthrough */
case IMSG_EOF:
}
int
-main_play_song(const char *song)
+main_play_song(const char *path)
{
struct stat sb;
- char path[PATH_MAX] = { 0 };
int fd;
- strlcpy(path, song, sizeof(path));
if ((fd = open(path, O_RDONLY)) == -1) {
log_warn("open %s", path);
return 0;
}
play_state = STATE_PLAYING;
- main_send_player(IMSG_PLAY, fd, path, sizeof(path));
+ main_send_player(IMSG_PLAY, fd, NULL, 0);
return 1;
}
blob - 4c839c50b4dc882266974106bff240a3a41bb793
blob + c62f252b1076d5bf82b1fff5281a68416e9112a7
--- player.c
+++ player.c
static struct imsgbuf *ibuf;
static int nextfd = -1;
-static char nextpath[PATH_MAX];
volatile sig_atomic_t halted;
void
player_enqueue(struct imsg *imsg)
{
- size_t datalen;
-
if (nextfd != -1)
fatalx("track already enqueued");
- datalen = IMSG_DATA_SIZE(*imsg);
- if (datalen != sizeof(nextpath))
- fatalx("%s: size mismatch", __func__);
- memcpy(nextpath, imsg->data, sizeof(nextpath));
- if (nextpath[datalen-1] != '\0')
- fatalx("%s: corrupted path", __func__);
if ((nextfd = imsg->fd) == -1)
fatalx("%s: got invalid file descriptor", __func__);
- log_debug("enqueued %s", nextpath);
+ log_debug("song enqueued");
}
/* process only one message */
/* 8 byte is the larger magic number */
if (r < 8) {
- log_warn("failed to read %s", nextpath);
+ log_warn("read failed");
goto err;
}
if (memmem(buf, r, "OggS", 4) != NULL)
return play_oggvorbis(fd);
- log_warnx("unknown file type for %s", nextpath);
+ log_warnx("unknown file type");
err:
close(fd);
return -1;