mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 10:51:52 -04:00
libfuse: fix narrowing conversion of nsec fields on i386 (#1593)
Some checks failed
mkdocs / deploy (push) Has been cancelled
Some checks failed
mkdocs / deploy (push) Has been cancelled
On 32 bit platforms tv_nsec is a signed long while the FUSE setattr arguments provide nanoseconds as uint32_t. C++17 treats uint32_t -> long in a brace initializer as a narrowing conversion and rejects it on ILP32 targets. This surfaced when building on FreeBSD i386 with clang 19 where the compiler refused the list initialization of struct timespec. Add explicit static_cast<long>() for the nsec fields to make the conversion intentional and portable. This avoids build failures on i386 while leaving 64 bit builds unchanged.
This commit is contained in:
parent
d3a3f65e7b
commit
d8918458bf
1 changed files with 2 additions and 2 deletions
|
|
@ -1636,12 +1636,12 @@ fuse_lib_setattr(fuse_req_t *req_,
|
|||
if(arg->valid & FATTR_ATIME_NOW)
|
||||
tv[0].tv_nsec = UTIME_NOW;
|
||||
else if(arg->valid & FATTR_ATIME)
|
||||
tv[0] = (struct timespec){ static_cast<time_t>(arg->atime), arg->atimensec };
|
||||
tv[0] = (struct timespec){ static_cast<time_t>(arg->atime), static_cast<long>(arg->atimensec) };
|
||||
|
||||
if(arg->valid & FATTR_MTIME_NOW)
|
||||
tv[1].tv_nsec = UTIME_NOW;
|
||||
else if(arg->valid & FATTR_MTIME)
|
||||
tv[1] = (struct timespec){ static_cast<time_t>(arg->mtime), arg->mtimensec };
|
||||
tv[1] = (struct timespec){ static_cast<time_t>(arg->mtime), static_cast<long>(arg->mtimensec) };
|
||||
|
||||
err = ((fusepath != NULL) ?
|
||||
f.ops.utimens(&req_->ctx,&fusepath[1],tv) :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue