mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-26 09:56:28 -05:00
fix name length calculation for musc
This commit is contained in:
parent
4cade5685c
commit
9b2634a1e5
3 changed files with 50 additions and 4 deletions
|
|
@ -45,6 +45,19 @@ using std::vector;
|
|||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
uint64_t
|
||||
dirent_exact_namelen(const struct dirent *d_)
|
||||
{
|
||||
#ifdef _D_EXACT_NAMELEN
|
||||
return _D_EXACT_NAMELEN(d_);
|
||||
#elif defined _DIRENT_HAVE_D_NAMLEN
|
||||
return d_->d_namlen;
|
||||
#else
|
||||
return strlen(d_->d_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
readdir_plus(const Branches &branches_,
|
||||
|
|
@ -83,7 +96,7 @@ namespace l
|
|||
rv = 0;
|
||||
for(struct dirent *de = fs::readdir(dh); de && !rv; de = fs::readdir(dh))
|
||||
{
|
||||
rv = names.put(de->d_name,_D_EXACT_NAMLEN(de));
|
||||
rv = names.put(de->d_name,l::dirent_exact_namelen(de));
|
||||
if(rv == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,19 @@ using std::vector;
|
|||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
uint64_t
|
||||
dirent_exact_namelen(const struct dirent *d_)
|
||||
{
|
||||
#ifdef _D_EXACT_NAMELEN
|
||||
return _D_EXACT_NAMELEN(d_);
|
||||
#elif defined _DIRENT_HAVE_D_NAMLEN
|
||||
return d_->d_namlen;
|
||||
#else
|
||||
return strlen(d_->d_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
readdir(const Branches &branches_,
|
||||
|
|
@ -74,7 +87,7 @@ namespace l
|
|||
rv = 0;
|
||||
for(struct dirent *de = fs::readdir(dh); de && !rv; de = fs::readdir(dh))
|
||||
{
|
||||
rv = names.put(de->d_name,_D_EXACT_NAMLEN(de));
|
||||
rv = names.put(de->d_name,l::dirent_exact_namelen(de));
|
||||
if(rv == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue