Commit d46c63e8 authored by Tommy Lindgren's avatar Tommy Lindgren Committed by Han-Wen Nienhuys

fs: return ENOTSUP if NodeMknoder isn't implemented

This avoids a panic.

Change-Id: I5c4cc0d875ecdbc3b07c2322b5a5a5e6fa493709
parent 0f728ba1
......@@ -418,6 +418,8 @@ func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name stri
var errno syscall.Errno
if mops, ok := parent.ops.(NodeMknoder); ok {
child, errno = mops.Mknod(&fuse.Context{Caller: input.Caller, Cancel: cancel}, name, input.Mode, input.Rdev, out)
} else {
return fuse.ENOTSUP
}
if errno != 0 {
......
......@@ -356,6 +356,24 @@ func TestMknod(t *testing.T) {
}
}
func TestMknodNotSupported(t *testing.T) {
mountPoint := testutil.TempDir()
defer os.Remove(mountPoint)
server, err := Mount(mountPoint, &Inode{}, nil)
if err != nil {
t.Fatalf("cannot mount: %v", err)
}
defer server.Unmount()
name := filepath.Join(mountPoint, "foo")
if got, want := syscall.Mknod(name, syscall.S_IFREG|0755, (8<<8)|0), syscall.ENOTSUP; got != want {
t.Fatalf("mknod: got %v, want %v", got, want)
}
}
func TestPosix(t *testing.T) {
noisy := map[string]bool{
"ParallelFileOpen": true,
......
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