aboutsummaryrefslogtreecommitdiff
path: root/lib/memfs/memfs_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-16 23:32:22 +0700
committerShulhan <ms@kilabit.info>2022-07-16 23:32:22 +0700
commitca2ded2b40eeb69ba7dda3facb2b7742f13b36a8 (patch)
tree315c7dce820fd454e99502f397e82925ccce2ab2 /lib/memfs/memfs_test.go
parent6e43f4b1af113c6cf70539e2a92ae13d9e523cb9 (diff)
downloadpakakeh.go-ca2ded2b40eeb69ba7dda3facb2b7742f13b36a8.tar.xz
lib/memfs: set the Root SysPath to the first MemFS instance on Merge
Previously, calling Merge(...), set the merged MemFS Root.SysPath to "..". Since we allow the TryDirect to access the file directly (if its set to true), this may cause the file system leaks if returned MemFS set this flag to true. To prevent that, we set the SysPath to the first MemFS SysPath.
Diffstat (limited to 'lib/memfs/memfs_test.go')
-rw-r--r--lib/memfs/memfs_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/memfs/memfs_test.go b/lib/memfs/memfs_test.go
index 22c71bf5..f61d2930 100644
--- a/lib/memfs/memfs_test.go
+++ b/lib/memfs/memfs_test.go
@@ -576,7 +576,7 @@ func TestMerge(t *testing.T) {
PathNodes: &PathNode{
v: map[string]*Node{
"/": &Node{
- SysPath: "..",
+ SysPath: mfsDirect.Root.SysPath,
Path: "/",
Childs: []*Node{
mfsDirect.MustGet("/add"),
@@ -596,7 +596,7 @@ func TestMerge(t *testing.T) {
PathNodes: &PathNode{
v: map[string]*Node{
"/": &Node{
- SysPath: "..",
+ SysPath: mfsDirect.Root.SysPath,
Path: "/",
Childs: []*Node{
mfsDirect.MustGet("/add"),