mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-13 09:06:43 +02:00
added creation mode "read" or "create" for pipe stream
This commit is contained in:
parent
28133c9091
commit
86b34af0c6
1 changed files with 13 additions and 2 deletions
|
@ -37,8 +37,19 @@ using namespace std;
|
||||||
PipeStream::PipeStream(PcmListener* pcmListener, const StreamUri& uri) : PcmStream(pcmListener, uri), fd_(-1)
|
PipeStream::PipeStream(PcmListener* pcmListener, const StreamUri& uri) : PcmStream(pcmListener, uri), fd_(-1)
|
||||||
{
|
{
|
||||||
umask(0);
|
umask(0);
|
||||||
if ((mkfifo(uri_.path.c_str(), 0666) != 0) && (errno != EEXIST))
|
string mode = uri_.query["mode"];
|
||||||
throw SnapException("failed to make fifo \"" + uri_.path + "\": " + cpt::to_string(errno));
|
if (mode.empty())
|
||||||
|
mode = "create";
|
||||||
|
|
||||||
|
logO << "PipeStream mode: " << mode << "\n";
|
||||||
|
if ((mode != "read") && (mode != "create"))
|
||||||
|
throw SnapException("create mode for fifo must be \"read\" or \"create\"");
|
||||||
|
|
||||||
|
if (mode == "create")
|
||||||
|
{
|
||||||
|
if ((mkfifo(uri_.path.c_str(), 0666) != 0) && (errno != EEXIST))
|
||||||
|
throw SnapException("failed to make fifo \"" + uri_.path + "\": " + cpt::to_string(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue