aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/posix_extras.cc13
-rw-r--r--src/posix_extras.h4
2 files changed, 3 insertions, 14 deletions
diff --git a/src/posix_extras.cc b/src/posix_extras.cc
index 6844785..359240f 100644
--- a/src/posix_extras.cc
+++ b/src/posix_extras.cc
@@ -75,19 +75,6 @@ struct stat File::LinkStatAt(const char* const path) const {
return result;
}
-File File::OpenAt(const char* const path, const int flags) const {
- if (path[0] == '/') {
- throw std::invalid_argument("absolute path");
- }
-
- File result;
- if ((result.fd_ = openat(fd_, path, flags)) == -1) {
- throw SystemError();
- }
- result.path_ = path_ + "/" + path;
- return result;
-}
-
File File::OpenAt(const char* const path, const int flags,
const mode_t mode) const {
if (path[0] == '/') {
diff --git a/src/posix_extras.h b/src/posix_extras.h
index f4e7c69..9bcbe51 100644
--- a/src/posix_extras.h
+++ b/src/posix_extras.h
@@ -68,7 +68,9 @@ class File {
// Calls openat(2) on the path relative to the file descriptor. The path must
// indeed be relative (i.e., it must not start with '/').
- File OpenAt(const char* path, int flags) const;
+ File OpenAt(const char* const path, const int flags) const {
+ return OpenAt(path, flags, 0);
+ }
File OpenAt(const char* path, int flags, mode_t mode) const;
// Removes the file at the path relative to the file descriptor. The path