commit e8b714d3046ec8ad01763eddcd928696171c4602
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 43b76b9..f15f88a 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -24,7 +24,7 @@ static int unionfs_readdir(struct file *file, void *dirent, 
filldir_t filldir)
        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 *file, void *dirent, 
filldir_t filldir)
 
        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 *file, void *dirent, 
filldir_t filldir)
 
                /* 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