Commit 3c64a018 authored by Ivan Krasin's avatar Ivan Krasin

Fixed the problem: filename has 0x00 symbol at the end

parent 7e853ab4
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"strings"
) )
const ( const (
...@@ -254,7 +255,7 @@ func readDir(fs FileSystem, h *InHeader, ing interface{}, c *managerClient) (int ...@@ -254,7 +255,7 @@ func readDir(fs FileSystem, h *InHeader, ing interface{}, c *managerClient) (int
} }
func lookup(h *InHeader, r *bytes.Buffer, c *managerClient) (interface{}, Status) { func lookup(h *InHeader, r *bytes.Buffer, c *managerClient) (interface{}, Status) {
filename := string(r.Bytes()) filename := strings.TrimRight(string(r.Bytes()), "\x00")
fmt.Printf("filename: %s\n", filename) fmt.Printf("filename: %s\n", filename)
resp := c.lookup(h.NodeId, filename) resp := c.lookup(h.NodeId, filename)
if resp.status != OK { if resp.status != OK {
......
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
) )
const ( const (
tempMountDir = "testMountDir" tempMountDir = "testMountDir2"
) )
var ( var (
testFileNames = []string{"one", "two", "three3"} testFileNames = []string{"one", "two", "three.txt"}
) )
type testFuse struct{} type testFuse struct{}
......
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