aboutsummaryrefslogtreecommitdiff
path: root/src/posix_extras.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/posix_extras.cc')
-rw-r--r--src/posix_extras.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/posix_extras.cc b/src/posix_extras.cc
index 4093cc0..6844785 100644
--- a/src/posix_extras.cc
+++ b/src/posix_extras.cc
@@ -102,6 +102,16 @@ File File::OpenAt(const char* const path, const int flags,
return result;
}
+void File::UnlinkAt(const char* const path) const {
+ if (path[0] == '/') {
+ throw std::invalid_argument("absolute path");
+ }
+
+ if (unlinkat(fd_, path, 0) == -1) {
+ throw SystemError();
+ }
+}
+
int File::Duplicate() const {
int result;
if ((result = dup(fd_)) == -1) {