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,9 +37,20 @@ using namespace std;
|
|||
PipeStream::PipeStream(PcmListener* pcmListener, const StreamUri& uri) : PcmStream(pcmListener, uri), fd_(-1)
|
||||
{
|
||||
umask(0);
|
||||
string mode = uri_.query["mode"];
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PipeStream::~PipeStream()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue