Commit Diff


commit - a7c21102d5a00f25af27b4f7ba894065aa28bb5f
commit + a975dca965d92cd6af18a82629b597668e1d69d8
blob - 65b5fdb20f1dcaf84bf7c53d54035fbbf6bafd0b
blob + 3ba1a4e03e9f2acefc5257e0a174a9a26b1ca4a8
--- amused.c
+++ amused.c
@@ -129,6 +129,7 @@ main_dispatch_player(int sig, short event, void *d)
 
 		switch (imsg.hdr.type) {
 		case IMSG_ERR:
+			log_warnx("failed to play, skipping %s", current_song);
 			playlist_dropcurrent();
 			/* fallthrough */
 		case IMSG_EOF:
@@ -358,13 +359,11 @@ main_send_player(uint16_t type, int fd, const void *da
 }
 
 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;
@@ -383,7 +382,7 @@ main_play_song(const char *song)
 	}
 
 	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
@@ -43,7 +43,6 @@ struct sio_hdl		*hdl;
 static struct imsgbuf	*ibuf;
 
 static int nextfd = -1;
-static char nextpath[PATH_MAX];
 
 volatile sig_atomic_t halted;
 
@@ -128,20 +127,12 @@ player_pendingimsg(void)
 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 */
@@ -210,7 +201,7 @@ player_playnext(void)
 
 	/* 8 byte is the larger magic number */
 	if (r < 8) {
-		log_warn("failed to read %s", nextpath);
+		log_warn("read failed");
 		goto err;
 	}
 
@@ -229,7 +220,7 @@ player_playnext(void)
 	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;