From bc63be33882f3a9540895451d8e0f470035b8fe7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 30 Jan 2013 19:08:16 +0100 Subject: [PATCH] open_fifo uses fcntl for more portable CLOEXEC bit setting --- src/commands.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands.cc b/src/commands.cc index 084b6601..669bc616 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -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);