From a3f0145561f56ffd81533f856e7a95488e8b2f39 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 1 Apr 2014 21:43:30 +0200 Subject: [PATCH] Open nonblock so it won't hang if other end is absent --- src/pipe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipe.c b/src/pipe.c index 86274da8..25e39ddb 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -38,7 +38,7 @@ #define PIPE_BUFFER_SIZE 8192 static int g_fd = -1; -static void *g_buf = NULL; +static uint16_t *g_buf = NULL; int pipe_setup(struct media_file_info *mfi) @@ -67,14 +67,14 @@ pipe_setup(struct media_file_info *mfi) pipe_cleanup(); - g_fd = open(mfi->path, O_RDONLY); + g_fd = open(mfi->path, O_RDONLY | O_NONBLOCK); if (g_fd < 0) { DPRINTF(E_LOG, L_PLAYER, "Could not open pipe for reading '%s': %s\n", mfi->path, strerror(errno)); return -1; } - g_buf = (void *)malloc(PIPE_BUFFER_SIZE); + g_buf = (uint16_t *)malloc(PIPE_BUFFER_SIZE); if (!g_buf) { DPRINTF(E_LOG, L_PLAYER, "Out of memory for buffer\n");