aboutsummaryrefslogtreecommitdiff
path: root/src/os/root_openat.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2024-11-12 17:16:10 +0100
committerDamien Neil <dneil@google.com>2024-11-20 23:21:14 +0000
commit49d24d469eb4ecbbf5a77d905ca2bd1da0e18bbd (patch)
tree620dfeb866b8bdc9174da763bd19e9cbd0e53b28 /src/os/root_openat.go
parent43d90c6a14e7b3fd1b3b8085b8071a09231c4b62 (diff)
downloadgo-49d24d469eb4ecbbf5a77d905ca2bd1da0e18bbd.tar.xz
os: add Root.Remove
For #67002 Change-Id: Ibbf44c0bf62f53695a7399ba0dae5b84d5efd374 Reviewed-on: https://go-review.googlesource.com/c/go/+/627076 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/os/root_openat.go')
-rw-r--r--src/os/root_openat.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/os/root_openat.go b/src/os/root_openat.go
index 7f6619bab4..a03208b4c1 100644
--- a/src/os/root_openat.go
+++ b/src/os/root_openat.go
@@ -74,6 +74,16 @@ func rootMkdir(r *Root, name string, perm FileMode) error {
return err
}
+func rootRemove(r *Root, name string) error {
+ _, err := doInRoot(r, name, func(parent sysfdType, name string) (struct{}, error) {
+ return struct{}{}, removeat(parent, name)
+ })
+ if err != nil {
+ return &PathError{Op: "removeat", Path: name, Err: err}
+ }
+ return err
+}
+
// doInRoot performs an operation on a path in a Root.
//
// It opens the directory containing the final element of the path,