open_fifo uses fcntl for more portable CLOEXEC bit setting

This commit is contained in:
Maxime Coste 2013-01-30 19:08:16 +01:00
parent 45367bf447
commit bc63be3388

View File

@ -52,7 +52,8 @@ Buffer* open_or_create(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)
throw runtime_error("unable to open " + filename);
Buffer* buffer = new Buffer(name, Buffer::Flags::Fifo | Buffer::Flags::NoUndo);