diff options
author | Jakob Unterwurzacher | 2017-05-01 17:49:37 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-05-01 17:49:37 +0200 |
commit | 9ab11aa4d775f7c1242e8b044cc2f8957cc2c784 (patch) | |
tree | f4f302b3573dff151b2290d6f1a2d9436cd24e57 /tests/defaults | |
parent | 514f515dd7196e26ca8df6886ac4a34e928e50dd (diff) |
fusefrontend: drop writeOnly flag
We do not have to track the writeOnly status because the kernel
will not forward read requests on a write-only FD to us anyway.
I have verified this behavoir manually on a 4.10.8 kernel and also
added a testcase.
Diffstat (limited to 'tests/defaults')
-rw-r--r-- | tests/defaults/main_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go index 52ca727..8c1b7e3 100644 --- a/tests/defaults/main_test.go +++ b/tests/defaults/main_test.go @@ -116,3 +116,18 @@ func TestOpenTruncateRead(t *testing.T) { t.Fatalf("wrong content: %s", string(content)) } } + +// TestWORead tries to read from a write-only file. +func TestWORead(t *testing.T) { + fn := test_helpers.DefaultPlainDir + "/TestWORead" + fd, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0600) + if err != nil { + t.Fatal(err) + } + defer fd.Close() + buf := make([]byte, 10) + _, err = fd.Read(buf) + if err == nil { + t.Error("Reading from write-only file should fail, but did not") + } +} |