NFSv4: A root pathname is sent as a zero component4

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Andy Adamson 2006-06-09 09:34:30 -04:00 committed by Trond Myklebust
parent 6b97fd3da1
commit 33a43f2802
1 changed files with 10 additions and 1 deletions

View File

@ -2408,8 +2408,10 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
READ_BUF(4); READ_BUF(4);
READ32(n); READ32(n);
if (n <= 0) if (n < 0)
goto out_eio; goto out_eio;
if (n == 0)
goto root_path;
dprintk("path "); dprintk("path ");
path->ncomponents = 0; path->ncomponents = 0;
while (path->ncomponents < n) { while (path->ncomponents < n) {
@ -2430,6 +2432,13 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
out: out:
dprintk("\n"); dprintk("\n");
return status; return status;
root_path:
/* a root pathname is sent as a zero component4 */
path->ncomponents = 1;
path->components[0].len=0;
path->components[0].data=NULL;
dprintk("path /\n");
goto out;
out_eio: out_eio:
dprintk(" status %d", status); dprintk(" status %d", status);
status = -EIO; status = -EIO;