Browse Source

provide stat to readdir filler. closes #32

pull/37/merge
Antonio SJ Musumeci 10 years ago
parent
commit
d7ede20abe
  1. 10
      src/readdir.cpp

10
src/readdir.cpp

@ -22,6 +22,8 @@
THE SOFTWARE. THE SOFTWARE.
*/ */
#define _BSD_SOURCE
#include <fuse.h> #include <fuse.h>
#include <string> #include <string>
@ -53,6 +55,7 @@ _readdir(const vector<string> &srcmounts,
const fuse_fill_dir_t filler) const fuse_fill_dir_t filler)
{ {
set<string> found; set<string> found;
struct stat st = {0};
for(vector<string>::const_iterator for(vector<string>::const_iterator
iter = srcmounts.begin(), enditer = srcmounts.end(); iter = srcmounts.begin(), enditer = srcmounts.end();
@ -69,12 +72,11 @@ _readdir(const vector<string> &srcmounts,
for(struct dirent *de = ::readdir(dh); de != NULL; de = ::readdir(dh)) for(struct dirent *de = ::readdir(dh); de != NULL; de = ::readdir(dh))
{ {
string d_name(de->d_name);
if(found.insert(d_name).second == false)
if(found.insert(de->d_name).second == false)
continue; continue;
if(filler(buf,de->d_name,NULL,NO_OFFSET) != 0)
st.st_mode = DTTOIF(de->d_type);
if(filler(buf,de->d_name,&st,NO_OFFSET) != 0)
return -ENOMEM; return -ENOMEM;
} }

Loading…
Cancel
Save