Remove artificial name length check.

This should be determined by the filesystem.

PiperOrigin-RevId: 218376553
Change-Id: I55d176e2cdf8acdd6642789af057b98bb8ca25b8
This commit is contained in:
Adin Scannell 2018-10-23 11:26:31 -07:00 committed by Shentubot
parent 692df85673
commit ce3a762038
1 changed files with 3 additions and 13 deletions

View File

@ -27,8 +27,6 @@ import (
"gvisor.googlesource.com/gvisor/pkg/log"
)
const maximumNameLength = 255
// ExtractErrno extracts a syscall.Errno from a error, best effort.
func ExtractErrno(err error) syscall.Errno {
switch err {
@ -109,13 +107,10 @@ func (t *Tflush) handle(cs *connState) message {
// checkSafeName validates the name and returns nil or returns an error.
func checkSafeName(name string) error {
if name == "" || strings.Contains(name, "/") || name == "." || name == ".." {
return syscall.EINVAL
}
if len(name) > maximumNameLength {
return syscall.ENAMETOOLONG
}
if name != "" && !strings.Contains(name, "/") && name != "." && name != ".." {
return nil
}
return syscall.EINVAL
}
// handle implements handler.handle.
@ -979,11 +974,6 @@ func (t *Tstatfs) handle(cs *connState) message {
return newErr(err)
}
// Constrain the name length.
if st.NameLength > maximumNameLength {
st.NameLength = maximumNameLength
}
return &Rstatfs{st}
}