Commit bbea6564 authored by Max Kellermann's avatar Max Kellermann

fs/output/FileOutputStream: use open_cloexec()

Support operating systems that don't have O_CLOEXEC.
parent 1ca8d7ad
......@@ -20,6 +20,7 @@
#include "config.h"
#include "FileOutputStream.hxx"
#include "fs/FileSystem.hxx"
#include "system/fd_util.h"
#include "util/Error.hxx"
#ifdef WIN32
......@@ -81,8 +82,8 @@ FileOutputStream::Cancel()
FileOutputStream::FileOutputStream(Path _path, Error &error)
:path(_path),
fd(open(path.c_str(),
O_WRONLY|O_CLOEXEC|O_CREAT|O_TRUNC|O_NOCTTY,
fd(open_cloexec(path.c_str(),
O_WRONLY|O_CREAT|O_TRUNC,
0666))
{
if (fd < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment