mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-19 14:36:36 -05:00
fix getdent name length calculation
This commit is contained in:
parent
b5fae4b356
commit
698c4147fc
9 changed files with 101 additions and 87 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "fs_inode.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "hashset.hpp"
|
||||
#include "linux_dirent64.h"
|
||||
#include "mempools.hpp"
|
||||
#include "rwlock.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
|
@ -43,15 +44,6 @@
|
|||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
struct linux_dirent64
|
||||
{
|
||||
uint64_t d_ino;
|
||||
int64_t d_off;
|
||||
uint16_t d_reclen;
|
||||
uint8_t d_type;
|
||||
char d_name[];
|
||||
};
|
||||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
|
|
@ -84,6 +76,7 @@ namespace l
|
|||
char *buf;
|
||||
HashSet names;
|
||||
string basepath;
|
||||
uint64_t namelen;
|
||||
struct stat st;
|
||||
fuse_entry_t entry;
|
||||
struct linux_dirent64 *d;
|
||||
|
|
@ -122,8 +115,9 @@ namespace l
|
|||
for(int64_t pos = 0; pos < nread; pos += d->d_reclen)
|
||||
{
|
||||
d = (struct linux_dirent64*)(buf + pos);
|
||||
namelen = (strlen(d->d_name) + 1);
|
||||
|
||||
rv = names.put(d->d_name);
|
||||
rv = names.put(d->d_name,namelen);
|
||||
if(rv == 0)
|
||||
continue;
|
||||
|
||||
|
|
@ -134,7 +128,7 @@ namespace l
|
|||
d->d_ino = fs::inode::recompute(d->d_ino,dev);
|
||||
st.st_ino = d->d_ino;
|
||||
|
||||
rv = fuse_dirents_add_linux_plus(buf_,d,&entry,&st);
|
||||
rv = fuse_dirents_add_linux_plus(buf_,d,namelen,&entry,&st);
|
||||
if(rv)
|
||||
return close_free_ret_enomem(dirfd,buf);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue