fs/io/File{Reader,OutputStream}: use OpenFile()
This commit is contained in:
parent
c1f0708a5d
commit
81df45a893
|
@ -20,7 +20,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "FileOutputStream.hxx"
|
#include "FileOutputStream.hxx"
|
||||||
#include "fs/FileSystem.hxx"
|
#include "fs/FileSystem.hxx"
|
||||||
#include "system/fd_util.h"
|
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -82,9 +81,9 @@ FileOutputStream::Cancel()
|
||||||
|
|
||||||
FileOutputStream::FileOutputStream(Path _path, Error &error)
|
FileOutputStream::FileOutputStream(Path _path, Error &error)
|
||||||
:path(_path),
|
:path(_path),
|
||||||
fd(open_cloexec(path.c_str(),
|
fd(OpenFile(path,
|
||||||
O_WRONLY|O_CREAT|O_TRUNC,
|
O_WRONLY|O_CREAT|O_TRUNC,
|
||||||
0666))
|
0666))
|
||||||
{
|
{
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
error.FormatErrno("Failed to create %s", path.c_str());
|
error.FormatErrno("Failed to create %s", path.c_str());
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "FileReader.hxx"
|
#include "FileReader.hxx"
|
||||||
#include "system/fd_util.h"
|
#include "fs/FileSystem.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -64,9 +64,9 @@ FileReader::Close()
|
||||||
|
|
||||||
FileReader::FileReader(Path _path, Error &error)
|
FileReader::FileReader(Path _path, Error &error)
|
||||||
:path(_path),
|
:path(_path),
|
||||||
fd(open_cloexec(path.c_str(),
|
fd(OpenFile(path,
|
||||||
O_RDONLY,
|
O_RDONLY,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
error.FormatErrno("Failed to open %s", path.c_str());
|
error.FormatErrno("Failed to open %s", path.c_str());
|
||||||
|
|
Loading…
Reference in New Issue