mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-23 11:32:34 -05:00
Open nonblock so it won't hang if other end is absent
This commit is contained in:
parent
16756a6632
commit
a3f0145561
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user