commit 02790259faf3aa6fe0dd70640ef7521570643493
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sun May 20 16:59:15 2007 -0400

    readdir bug, set fpos back to previous dirent if buffer overflows

diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 
43b76b9f9fcb1288d4312eb16f0689ee990bb1f9..f15f88ab4df03c26daa03edc7a550040ee62196a
 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -24,7 +24,7 @@ static int unionfs_readdir(struct file *
        struct file *odf_file = NULL;
        struct inode *inode = NULL;
        struct odf_dentry_info *odi = NULL;
-       loff_t size;
+       loff_t size, pos;
        int overflow = 0;
        /* dirent */
        u64 ino;
@@ -86,6 +86,8 @@ static int unionfs_readdir(struct file *
 
        size = odi->dentry->d_inode->i_size;
        while (odf_file->f_pos < size && !overflow) {
+
+               pos = odf_file->f_pos;
                /* read the next dirent */
                err = odf_read_dirent(odf_file, &name, &namelen, &ino, &d_type);
                if (err)
@@ -93,6 +95,8 @@ static int unionfs_readdir(struct file *
 
                /* filldir */
                overflow = filldir(dirent, name, namelen, odf_file->f_pos, ino, 
d_type);
+               if (overflow)
+                       odf_file->f_pos = pos; /* so the caller can re-read 
this dirent*/
        }
 
        /* Copy the atime. */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to