From 28a87f4a6532304b2ede31998b03fbad740f4fa3 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sat, 20 Feb 2016 13:45:09 -0500 Subject: Unify constructors for File --- src/posix_extras.cc | 7 ------- src/posix_extras.h | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/posix_extras.cc b/src/posix_extras.cc index 6013b9b..2aeda7b 100644 --- a/src/posix_extras.cc +++ b/src/posix_extras.cc @@ -51,13 +51,6 @@ std::string IoError::Message(const int number) noexcept { return "(could not generate error message)"; } -File::File(const char* const path, const int flags) : path_(path) { - if ((fd_ = open(path, flags)) == -1) { - throw IoError(); - } - VLOG(1) << "opening file descriptor " << fd_; -} - File::File(const char* const path, const int flags, const mode_t mode) : path_(path) { if ((fd_ = open(path, flags, mode)) == -1) { diff --git a/src/posix_extras.h b/src/posix_extras.h index 840b448..6f2fb37 100644 --- a/src/posix_extras.h +++ b/src/posix_extras.h @@ -70,7 +70,7 @@ class Directory { // RAII wrapper for Unix file descriptors. class File { public: - File(const char* path, int flags); + File(const char* path, int flags) : File(path, flags, 0777) {} File(const char* path, int flags, mode_t mode); File(const File&); File(File&& other) = default; -- cgit v1.2.3