From b5fd6f72e3a8333da2e82920a027dfb6a0b60165 Mon Sep 17 00:00:00 2001 From: Emanuel Haupt Date: Sat, 29 Nov 2025 11:10:11 +0100 Subject: [PATCH] libfuse: fix narrowing conversion of nsec fields on i386 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() for the nsec fields to make the conversion intentional and portable. This avoids build failures on i386 while leaving 64 bit builds unchanged. --- libfuse/lib/fuse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfuse/lib/fuse.cpp b/libfuse/lib/fuse.cpp index f4b6c6e2..6e4efec0 100644 --- a/libfuse/lib/fuse.cpp +++ b/libfuse/lib/fuse.cpp @@ -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(arg->atime), arg->atimensec }; + tv[0] = (struct timespec){ static_cast(arg->atime), static_cast(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(arg->mtime), arg->mtimensec }; + tv[1] = (struct timespec){ static_cast(arg->mtime), static_cast(arg->mtimensec) }; err = ((fusepath != NULL) ? f.ops.utimens(&req_->ctx,&fusepath[1],tv) :