On Mon, 2019-06-03 at 10:21 -0400, Steve Dickson wrote: > > On 5/31/19 11:52 AM, J. Bruce Fields wrote: > > On Tue, May 28, 2019 at 04:31:15PM -0400, Trond Myklebust wrote: > > > +char * > > > +nfsd_path_strip_root(char *pathname) > > > +{ > > > + const char *dir = nfsd_path_nfsd_rootdir(); > > > + char *ret; > > > + > > > + ret = strstr(pathname, dir); > > > + if (!ret || ret != pathname) > > > + return pathname; > > > > Shouldn't we return NULL or an error or something here? It seems a > > little strange not to care if the path began with root or not. I > > guess > > I need to look at the caller.... > Well pathname will never be NULL... It is returning what is passed > in, > but it might be nice to know about the memory failure. > Either way, I figure we also want to canonicalise 'dir' before we apply it, just in case people have amused themselves by composing rootdir values of the form '/foo/./bar/./../bar/'. Another patch forthcoming for this. -- Trond Myklebust Linux NFS client maintainer, Hammerspace trond.myklebust@xxxxxxxxxxxxxxx