Commit 40776fb9 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix brown-paper-bag bug with MemNodeFs.

parent 7a509a55
......@@ -124,7 +124,7 @@ func (n *memNode) Create(name string, flags uint32, mode uint32, context *Contex
ch := n.newNode(false)
ch.info.Mode = mode | S_IFREG
f, err := os.Create(n.filename())
f, err := os.Create(ch.filename())
if err != nil {
return nil, nil, ToStatus(err)
}
......
......@@ -40,6 +40,20 @@ func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
}
func TestMemNodeFsWrite(t *testing.T) {
wd, _, clean := setupMemNodeTest(t)
defer clean()
want := "hello"
err := ioutil.WriteFile(wd+"/test", []byte(want), 0644)
CheckSuccess(err)
content, err := ioutil.ReadFile(wd +"/test")
if string(content) != want {
t.Fatalf("content mismatch: got %q, want %q", content, want)
}
}
func TestMemNodeFs(t *testing.T) {
wd, _, clean := setupMemNodeTest(t)
defer clean()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment