io/Open: add flags parameter to OpenReadOnly()

This commit is contained in:
Max Kellermann 2020-04-30 21:30:57 +02:00 committed by Max Kellermann
parent 4e88f95f94
commit a584141cae
2 changed files with 3 additions and 3 deletions

View File

@ -34,10 +34,10 @@
#include <fcntl.h> #include <fcntl.h>
UniqueFileDescriptor UniqueFileDescriptor
OpenReadOnly(const char *path) OpenReadOnly(const char *path, int flags)
{ {
UniqueFileDescriptor fd; UniqueFileDescriptor fd;
if (!fd.OpenReadOnly(path)) if (!fd.Open(path, O_RDONLY|flags))
throw FormatErrno("Failed to open '%s'", path); throw FormatErrno("Failed to open '%s'", path);
return fd; return fd;

View File

@ -34,7 +34,7 @@ class FileDescriptor;
class UniqueFileDescriptor; class UniqueFileDescriptor;
UniqueFileDescriptor UniqueFileDescriptor
OpenReadOnly(const char *path); OpenReadOnly(const char *path, int flags=0);
UniqueFileDescriptor UniqueFileDescriptor
OpenWriteOnly(const char *path, int flags=0); OpenWriteOnly(const char *path, int flags=0);