lkml.org 
[lkml]   [2005]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] FUSE: readdir fixes
From
Date
This patch correctly sets f_pos in readdir.  The offset passed from
userspace is now the offset of the next entry. Needs at least libfuse
2.3-pre2 to work properly.

Zero lengh filenames are also disallowed.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

diff -rup linux-2.6.12-rc1-mm4/fs/fuse/dir.c linux-fuse/fs/fuse/dir.c
--- linux-2.6.12-rc1-mm4/fs/fuse/dir.c 2005-03-31 21:52:18.000000000 +0200
+++ linux-fuse/fs/fuse/dir.c 2005-04-01 22:49:25.000000000 +0200
@@ -477,19 +477,19 @@ static int parse_dirfile(char *buf, size
struct fuse_dirent *dirent = (struct fuse_dirent *) buf;
size_t reclen = FUSE_DIRENT_SIZE(dirent);
int over;
- if (dirent->namelen > FUSE_NAME_MAX)
+ if (!dirent->namelen || dirent->namelen > FUSE_NAME_MAX)
return -EIO;
if (reclen > nbytes)
break;

over = filldir(dstbuf, dirent->name, dirent->namelen,
- dirent->off, dirent->ino, dirent->type);
+ file->f_pos, dirent->ino, dirent->type);
if (over)
break;

buf += reclen;
- file->f_pos += reclen;
nbytes -= reclen;
+ file->f_pos = dirent->off;
}

return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-04-06 13:31    [W:0.032 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site