summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-01-25 18:39:15 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-25 18:39:15 -0800
commit99f13909578d2dbebedc32f62884a486096e6fa8 (patch)
tree76e95f73469ae49e5be12f4a929d9abd52008579
parentceddc751d7a2764da56a573de83202f30843c45b (diff)
parent75e17a8908d52e32f5de85b90b74e156265c60c6 (diff)
downloadsystem_core-99f13909578d2dbebedc32f62884a486096e6fa8.zip
system_core-99f13909578d2dbebedc32f62884a486096e6fa8.tar.gz
system_core-99f13909578d2dbebedc32f62884a486096e6fa8.tar.bz2
am 75e17a89: sdcard: Fix readdir implementation so rewinddir will work correctly
* commit '75e17a8908d52e32f5de85b90b74e156265c60c6': sdcard: Fix readdir implementation so rewinddir will work correctly
-rw-r--r--sdcard/sdcard.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 9bb9d4b..0b8f656 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -845,13 +845,19 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
struct dirent *de;
struct dirhandle *h = id_to_ptr(req->fh);
TRACE("READDIR %p\n", h);
+ if (req->offset == 0) {
+ /* rewinddir() might have been called above us, so rewind here too */
+ TRACE("calling rewinddir()\n");
+ rewinddir(h->d);
+ }
de = readdir(h->d);
if (!de) {
fuse_status(fuse, hdr->unique, 0);
return;
}
fde->ino = FUSE_UNKNOWN_INO;
- fde->off = 0;
+ /* increment the offset so we can detect when rewinddir() seeks back to the beginning */
+ fde->off = req->offset + 1;
fde->type = de->d_type;
fde->namelen = strlen(de->d_name);
memcpy(fde->name, de->d_name, fde->namelen + 1);