open_fifo uses fcntl for more portable CLOEXEC bit setting
This commit is contained in:
parent
45367bf447
commit
bc63be3388
|
@ -52,7 +52,8 @@ Buffer* open_or_create(const String& filename, Context& context)
|
||||||
|
|
||||||
Buffer* open_fifo(const String& name , const String& filename, Context& context)
|
Buffer* open_fifo(const String& name , const String& filename, Context& context)
|
||||||
{
|
{
|
||||||
int fd = open(filename.c_str(), O_RDONLY | O_CLOEXEC);
|
int fd = open(filename.c_str(), O_RDONLY);
|
||||||
|
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
throw runtime_error("unable to open " + filename);
|
throw runtime_error("unable to open " + filename);
|
||||||
Buffer* buffer = new Buffer(name, Buffer::Flags::Fifo | Buffer::Flags::NoUndo);
|
Buffer* buffer = new Buffer(name, Buffer::Flags::Fifo | Buffer::Flags::NoUndo);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user