diff --git a/src/fs.cpp b/src/fs.cpp index 31a2a521..91d66e0c 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -151,7 +151,7 @@ namespace fs return -1; dev = st.st_dev; - for(int i = 0, ei = srcmounts.size(); i != ei; i++) + for(size_t i = 0, ei = srcmounts.size(); i != ei; i++) { fs::path::make(&srcmounts[i],fusepath,fullpath); @@ -241,7 +241,7 @@ namespace fs if(spaceavail <= mfs) continue; - mfs = spaceavail; + mfs = (fsblkcnt_t)spaceavail; mfsbasepath = &basepaths[i]; } diff --git a/src/fs_acl.cpp b/src/fs_acl.cpp index 65b40bb2..d30ceecf 100644 --- a/src/fs_acl.cpp +++ b/src/fs_acl.cpp @@ -30,7 +30,7 @@ namespace fs bool dir_has_defaults(const std::string &fullpath) { - int rv; + ssize_t rv; std::string dirpath = fullpath; fs::path::dirname(dirpath); diff --git a/src/fs_base_getxattr.hpp b/src/fs_base_getxattr.hpp index eb3deb17..b0ec163b 100644 --- a/src/fs_base_getxattr.hpp +++ b/src/fs_base_getxattr.hpp @@ -28,7 +28,7 @@ namespace fs { static inline - int + ssize_t lgetxattr(const std::string &path, const char *attrname, void *value, diff --git a/src/fs_base_ioctl.hpp b/src/fs_base_ioctl.hpp index 9de63983..980378b6 100644 --- a/src/fs_base_ioctl.hpp +++ b/src/fs_base_ioctl.hpp @@ -26,9 +26,9 @@ namespace fs static inline int - ioctl(const int fd, - const int request, - void *data) + ioctl(const int fd, + const unsigned long request, + void *data) { return ::ioctl(fd,request,data); } diff --git a/src/fs_base_listxattr.hpp b/src/fs_base_listxattr.hpp index 4e651679..1ce6020d 100644 --- a/src/fs_base_listxattr.hpp +++ b/src/fs_base_listxattr.hpp @@ -28,7 +28,7 @@ namespace fs { static inline - int + ssize_t llistxattr(const std::string &path, char *list, const size_t size) diff --git a/src/fs_base_readlink.hpp b/src/fs_base_readlink.hpp index efe7fa47..b0c6cb92 100644 --- a/src/fs_base_readlink.hpp +++ b/src/fs_base_readlink.hpp @@ -27,7 +27,7 @@ namespace fs { static inline - int + ssize_t readlink(const std::string &path, char *buf, const size_t bufsiz) diff --git a/src/fs_clonefile.cpp b/src/fs_clonefile.cpp index 826790b9..0def2166 100644 --- a/src/fs_clonefile.cpp +++ b/src/fs_clonefile.cpp @@ -48,13 +48,13 @@ using std::string; using std::vector; -int +ssize_t writen(const int fd, const char *buf, const size_t count) { size_t nleft; - ssize_t nwritten; + ssize_t nwritten = 0; nleft = count; while(nleft > 0) @@ -67,15 +67,15 @@ writen(const int fd, return -1; } - nleft -= nwritten; - buf += nwritten; + nleft -= (size_t)nwritten; + buf += (size_t)nwritten; } - return count; + return nwritten; } static -int +ssize_t copyfile_rw(const int fdin, const int fdout, const size_t count, @@ -83,8 +83,8 @@ copyfile_rw(const int fdin, { ssize_t nr; ssize_t nw; - ssize_t bufsize; - size_t totalwritten; + size_t bufsize; + ssize_t totalwritten; vector buf; bufsize = (blocksize * 16); @@ -93,7 +93,7 @@ copyfile_rw(const int fdin, fs::lseek(fdin,0,SEEK_SET); totalwritten = 0; - while(totalwritten < count) + while(totalwritten < (ssize_t)count) { nr = fs::read(fdin,&buf[0],bufsize); if(nr == -1) @@ -103,29 +103,30 @@ copyfile_rw(const int fdin, return -1; } - nw = writen(fdout,&buf[0],nr); + nw = writen(fdout,&buf[0],(size_t)nr); if(nw == -1) return -1; totalwritten += nw; } - return count; + return totalwritten; } static -int +ssize_t copydata(const int fdin, const int fdout, const size_t count, const size_t blocksize) { - int rv; + ssize_t rv; + off_t scount = (off_t)count; + + fs::fadvise(fdin,0,scount,POSIX_FADV_WILLNEED); + fs::fadvise(fdin,0,scount,POSIX_FADV_SEQUENTIAL); - fs::fadvise(fdin,0,count,POSIX_FADV_WILLNEED); - fs::fadvise(fdin,0,count,POSIX_FADV_SEQUENTIAL); - - fs::fallocate(fdout,0,0,count); + fs::fallocate(fdout,0,0,scount); rv = fs::sendfile(fdin,fdout,count); if((rv == -1) && ((errno == EINVAL) || (errno == ENOSYS))) @@ -153,18 +154,18 @@ ignorable_error(const int err) namespace fs { - int + ssize_t clonefile(const int fdin, const int fdout) { - int rv; + ssize_t rv; struct stat stin; rv = fs::fstat(fdin,stin); if(rv == -1) return -1; - rv = ::copydata(fdin,fdout,stin.st_size,stin.st_blksize); + rv = ::copydata(fdin,fdout,(size_t)stin.st_size,(size_t)stin.st_blksize); if(rv == -1) return -1; @@ -191,11 +192,11 @@ namespace fs return 0; } - int + ssize_t clonefile(const string &in, const string &out) { - int rv; + ssize_t rv; int fdin; int fdout; int error; diff --git a/src/fs_inode.hpp b/src/fs_inode.hpp index 7e07a7e0..683a83f0 100644 --- a/src/fs_inode.hpp +++ b/src/fs_inode.hpp @@ -34,7 +34,11 @@ namespace fs void recompute(struct stat &st) { - uint64_t st_dev = st.st_dev; /* Mac OS has a 32-bit device ID */ + /* + Some OSes have 32-bit device IDs, so box this up first. + This does also presume a 64-bit inode value. + */ + uint64_t st_dev = (uint64_t)st.st_dev; st.st_ino |= (st_dev << 32); } } diff --git a/src/fs_movefile.cpp b/src/fs_movefile.cpp index 1ca1fa54..b0271553 100644 --- a/src/fs_movefile.cpp +++ b/src/fs_movefile.cpp @@ -66,7 +66,7 @@ namespace fs return -1; fdin_st.st_size += additional_size; - rv = fs::mfs(basepaths,fdin_st.st_size,fdout_path); + rv = fs::mfs(basepaths,(uint64_t)fdin_st.st_size,fdout_path); if(rv == -1) return -1; diff --git a/src/fs_xattr.cpp b/src/fs_xattr.cpp index f468ac9e..94d9c764 100644 --- a/src/fs_xattr.cpp +++ b/src/fs_xattr.cpp @@ -63,19 +63,19 @@ using std::istringstream; return ::fgetxattr(fd, name, value, size, 0, 0); } - int + ssize_t _lgetxattr(const char* path, const char* name, char* value, size_t size) { return ::getxattr(path, name, value, size, 0, XATTR_NOFOLLOW); } - int + ssize_t _fsetxattr(int fd, const char* name, const char* value, size_t size, int flags) { return ::fsetxattr(fd, name, value, size, 0, flags); } - int + ssize_t _lsetxattr(const char* path, const char* name, const char* value, size_t size, int flags) { return ::setxattr(path, name, value, size, 0, flags && XATTR_NOFOLLOW); @@ -94,7 +94,7 @@ namespace fs { namespace xattr { - int + ssize_t list(const int fd, vector &attrs) { @@ -109,9 +109,9 @@ namespace fs if(rv <= 0) return rv; - attrs.resize(rv); + attrs.resize((size_t)rv); - rv = _flistxattr(fd,&attrs[0],rv); + rv = _flistxattr(fd,&attrs[0],(size_t)rv); } return rv; @@ -120,7 +120,7 @@ namespace fs #endif } - int + ssize_t list(const string &path, vector &attrs) { @@ -135,9 +135,9 @@ namespace fs if(rv <= 0) return rv; - attrs.resize(rv); + attrs.resize((size_t)rv); - rv = _llistxattr(path.c_str(),&attrs[0],rv); + rv = _llistxattr(path.c_str(),&attrs[0],(size_t)rv); } return rv; @@ -146,11 +146,11 @@ namespace fs #endif } - int + ssize_t list(const int fd, vector &attrvector) { - int rv; + ssize_t rv; vector attrs; rv = list(fd,attrs); @@ -163,11 +163,11 @@ namespace fs return rv; } - int + ssize_t list(const string &path, vector &attrvector) { - int rv; + ssize_t rv; vector attrs; rv = list(path,attrs); @@ -180,11 +180,11 @@ namespace fs return rv; } - int + ssize_t list(const int fd, string &attrstr) { - int rv; + ssize_t rv; vector attrs; rv = list(fd,attrs); @@ -194,11 +194,11 @@ namespace fs return rv; } - int + ssize_t list(const string &path, string &attrstr) { - int rv; + ssize_t rv; vector attrs; rv = list(path,attrs); @@ -208,7 +208,7 @@ namespace fs return rv; } - int + ssize_t get(const int fd, const string &attr, vector &value) @@ -224,9 +224,9 @@ namespace fs if(rv <= 0) return rv; - value.resize(rv); + value.resize((size_t)rv); - rv = _fgetxattr(fd,attr.c_str(),&value[0],rv); + rv = _fgetxattr(fd,attr.c_str(),&value[0],(size_t)rv); } return rv; @@ -235,7 +235,7 @@ namespace fs #endif } - int + ssize_t get(const string &path, const string &attr, vector &value) @@ -251,9 +251,9 @@ namespace fs if(rv <= 0) return rv; - value.resize(rv); + value.resize((size_t)rv); - rv = _lgetxattr(path.c_str(),attr.c_str(),&value[0],rv); + rv = _lgetxattr(path.c_str(),attr.c_str(),&value[0],(size_t)rv); } return rv; @@ -262,12 +262,12 @@ namespace fs #endif } - int + ssize_t get(const int fd, const string &attr, string &value) { - int rv; + ssize_t rv; vector tmpvalue; rv = get(fd,attr,tmpvalue); @@ -277,12 +277,12 @@ namespace fs return rv; } - int + ssize_t get(const string &path, const string &attr, string &value) { - int rv; + ssize_t rv; vector tmpvalue; rv = get(path,attr,tmpvalue); @@ -292,11 +292,11 @@ namespace fs return rv; } - int + ssize_t get(const int fd, map &attrs) { - int rv; + ssize_t rv; string attrstr; rv = list(fd,attrstr); @@ -320,11 +320,11 @@ namespace fs return 0; } - int + ssize_t get(const string &path, map &attrs) { - int rv; + ssize_t rv; string attrstr; rv = list(path,attrstr); @@ -348,7 +348,7 @@ namespace fs return 0; } - int + ssize_t set(const int fd, const string &key, const string &value, @@ -365,7 +365,7 @@ namespace fs #endif } - int + ssize_t set(const string &path, const string &key, const string &value, @@ -382,11 +382,11 @@ namespace fs #endif } - int + ssize_t set(const int fd, const map &attrs) { - int rv; + ssize_t rv; for(map::const_iterator i = attrs.begin(), ei = attrs.end(); i != ei; ++i) @@ -414,11 +414,11 @@ namespace fs return fs::close(fd); } - int + ssize_t copy(const int fdin, const int fdout) { - int rv; + ssize_t rv; map attrs; rv = get(fdin,attrs); @@ -428,11 +428,11 @@ namespace fs return set(fdout,attrs); } - int + ssize_t copy(const string &from, const string &to) { - int rv; + ssize_t rv; map attrs; rv = get(from,attrs); diff --git a/src/getxattr.cpp b/src/getxattr.cpp index 63536c4e..ce4b3c1c 100644 --- a/src/getxattr.cpp +++ b/src/getxattr.cpp @@ -39,13 +39,13 @@ using std::set; using namespace mergerfs; static -int +ssize_t _lgetxattr(const string &path, const char *attrname, void *value, const size_t size) { - int rv; + ssize_t rv; rv = fs::lgetxattr(path,attrname,value,size); @@ -153,7 +153,7 @@ _getxattr_pid(string &attrvalue) } static -int +ssize_t _getxattr_controlfile(const Config &config, const char *attrname, char *buf, @@ -198,7 +198,7 @@ _getxattr_controlfile(const Config &config, len = attrvalue.size(); if(count == 0) - return len; + return (ssize_t)len; if(count < len) return -ERANGE; @@ -209,7 +209,7 @@ _getxattr_controlfile(const Config &config, } static -int +ssize_t _getxattr_from_string(char *destbuf, const size_t destbufsize, const string &src) @@ -217,18 +217,18 @@ _getxattr_from_string(char *destbuf, const size_t srcbufsize = src.size(); if(destbufsize == 0) - return srcbufsize; + return (ssize_t)srcbufsize; if(srcbufsize > destbufsize) return -ERANGE; memcpy(destbuf,src.data(),srcbufsize); - return srcbufsize; + return (ssize_t)srcbufsize; } static -int +ssize_t _getxattr_user_mergerfs_allpaths(const vector &srcmounts, const char *fusepath, char *buf, @@ -245,7 +245,7 @@ _getxattr_user_mergerfs_allpaths(const vector &srcmounts, } static -int +ssize_t _getxattr_user_mergerfs(const string &basepath, const char *fusepath, const string &fullpath, @@ -271,7 +271,7 @@ _getxattr_user_mergerfs(const string &basepath, } static -int +ssize_t _getxattr(Policy::Func::Search searchFunc, const vector &srcmounts, const size_t minfreespace, @@ -280,7 +280,7 @@ _getxattr(Policy::Func::Search searchFunc, char *buf, const size_t count) { - int rv; + ssize_t rv; string fullpath; vector basepaths; @@ -303,14 +303,14 @@ namespace mergerfs namespace fuse { #if __APPLE__ - int + ssize_t getxattr(const char *fusepath, const char *attrname, char *buf, size_t count, uint32_t position) #else - int + ssize_t getxattr(const char *fusepath, const char *attrname, char *buf, @@ -331,7 +331,7 @@ namespace mergerfs return _getxattr(config.getxattr, config.srcmounts, - config.minfreespace, + (size_t)config.minfreespace, fusepath, attrname, buf, diff --git a/src/gidcache.cpp b/src/gidcache.cpp index 0d5afbfb..995e0d6e 100644 --- a/src/gidcache.cpp +++ b/src/gidcache.cpp @@ -66,8 +66,8 @@ gid_t_cache::lower_bound(gid_t_rec *begin, gid_t_rec *end, const uid_t uid) { - int step; - int count; + long step; + long count; gid_t_rec *iter; count = std::distance(begin,end); @@ -106,15 +106,19 @@ gid_t_cache::cache(const uid_t uid, rv = ::getpwuid_r(uid,&pwd,buf,sizeof(buf),&pwdrv); if(pwdrv != NULL && rv == 0) { + #if __APPLE__ + // OSX: getgrouplist(const char *name, int basegid, int *groups, int *ngroups) rec->size = 0; - ::getgrouplist(pwd.pw_name,gid,NULL,&rec->size); + ::getgrouplist(pwd.pw_name,(int)gid,NULL,&rec->size); rec->size = std::min(MAXGIDS,rec->size); - #if __APPLE__ - // OSX: getgrouplist(const char *name, int basegid, int *groups, int *ngroups) - rv = ::getgrouplist(pwd.pw_name,gid,(int*)rec->gids,&rec->size); + rv = ::getgrouplist(pwd.pw_name,(int)gid,(int*)rec->gids,&rec->size); #else // Linux: getgrouplist(const char *name, gid_t group, gid_t *groups int *ngroups) + rec->size = 0; + ::getgrouplist(pwd.pw_name,gid,NULL,&rec->size); + rec->size = std::min(MAXGIDS,rec->size); + rv = ::getgrouplist(pwd.pw_name,gid,rec->gids,&rec->size); #endif diff --git a/src/ioctl.cpp b/src/ioctl.cpp index c081bfc9..c3aa89f1 100644 --- a/src/ioctl.cpp +++ b/src/ioctl.cpp @@ -37,9 +37,9 @@ using namespace mergerfs; static int -_ioctl(const int fd, - const int cmd, - void *data) +_ioctl(const int fd, + const unsigned long cmd, + void *data) { int rv; @@ -60,7 +60,7 @@ _ioctl_dir_base(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, const char *fusepath, - const int cmd, + const unsigned long cmd, void *data) { int fd; @@ -88,9 +88,9 @@ _ioctl_dir_base(Policy::Func::Search searchFunc, static int -_ioctl_dir(const char *fusepath, - const int cmd, - void *data) +_ioctl_dir(const char *fusepath, + const unsigned long cmd, + void *data) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); @@ -121,13 +121,13 @@ namespace mergerfs #ifdef FUSE_IOCTL_DIR if(flags & FUSE_IOCTL_DIR) return _ioctl_dir(fusepath, - cmd, + (unsigned long)cmd, data); #endif FileInfo *fi = reinterpret_cast(ffi->fh); return _ioctl(fi->fd, - cmd, + (unsigned long)cmd, data); } } diff --git a/src/listxattr.cpp b/src/listxattr.cpp index b84be9ef..1c723f29 100644 --- a/src/listxattr.cpp +++ b/src/listxattr.cpp @@ -36,7 +36,7 @@ using std::vector; using namespace mergerfs; static -int +ssize_t _listxattr_controlfile(char *list, const size_t size) { @@ -59,18 +59,18 @@ _listxattr_controlfile(char *list, xattrs += ("user.mergerfs.func." + (std::string)*FuseFunc::fusefuncs[i] + '\0'); if(size == 0) - return xattrs.size(); + return (ssize_t)xattrs.size(); if(size < xattrs.size()) return -ERANGE; memcpy(list,xattrs.c_str(),xattrs.size()); - return xattrs.size(); + return (ssize_t)xattrs.size(); } static -int +ssize_t _listxattr(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, @@ -78,7 +78,7 @@ _listxattr(Policy::Func::Search searchFunc, char *list, const size_t size) { - int rv; + ssize_t rv; string fullpath; vector basepaths; @@ -97,7 +97,7 @@ namespace mergerfs { namespace fuse { - int + ssize_t listxattr(const char *fusepath, char *list, size_t size) diff --git a/src/mergerfs.cpp b/src/mergerfs.cpp index 5b65b732..43aa2e62 100644 --- a/src/mergerfs.cpp +++ b/src/mergerfs.cpp @@ -142,7 +142,7 @@ namespace local { const int prio = -10; - std::srand(time(NULL)); + std::srand((unsigned int)time(NULL)); mergerfs::resources::reset_umask(); mergerfs::resources::maxout_rlimit_nofile(); mergerfs::resources::maxout_rlimit_fsize(); diff --git a/src/num.cpp b/src/num.cpp index 7f6a0ec4..3e1894ca 100644 --- a/src/num.cpp +++ b/src/num.cpp @@ -28,7 +28,7 @@ namespace num char *endptr; uint64_t tmp; - tmp = strtoll(str.c_str(),&endptr,10); + tmp = strtoul(str.c_str(),&endptr,10); switch(*endptr) { case 'k': diff --git a/src/read.cpp b/src/read.cpp index 80d08c09..e3b8ea71 100644 --- a/src/read.cpp +++ b/src/read.cpp @@ -26,32 +26,30 @@ static inline -int +ssize_t _read(const int fd, void *buf, const size_t count, const off_t offset) { - int rv; + ssize_t rv; rv = fs::pread(fd,buf,count,offset); if(rv == -1) return -errno; - if(rv == 0) - return 0; - return count; + return rv; } static inline -int +ssize_t _read_direct_io(const int fd, void *buf, const size_t count, const off_t offset) { - int rv; + ssize_t rv; rv = fs::pread(fd,buf,count,offset); if(rv == -1) @@ -64,7 +62,7 @@ namespace mergerfs { namespace fuse { - int + ssize_t read(const char *fusepath, char *buf, size_t count, @@ -76,7 +74,7 @@ namespace mergerfs return _read(fi->fd,buf,count,offset); } - int + ssize_t read_direct_io(const char *fusepath, char *buf, size_t count, diff --git a/src/readdir.cpp b/src/readdir.cpp index 56d8e054..c8d5d775 100644 --- a/src/readdir.cpp +++ b/src/readdir.cpp @@ -50,7 +50,7 @@ _readdir(const vector &srcmounts, void *buf, const fuse_fill_dir_t filler) { - StrSet names; + StrSet names = StrSet(); string basepath; struct stat st = {0}; @@ -69,7 +69,7 @@ _readdir(const vector &srcmounts, dirfd = fs::dirfd(dh); st.st_dev = fs::devid(dirfd); if(st.st_dev == (dev_t)-1) - st.st_dev = i; + st.st_dev = (dev_t)i; rv = 0; for(struct dirent *de = fs::readdir(dh); de && !rv; de = fs::readdir(dh)) @@ -79,7 +79,7 @@ _readdir(const vector &srcmounts, continue; st.st_ino = de->d_ino; - st.st_mode = DTTOIF(de->d_type); + st.st_mode = (mode_t)DTTOIF(de->d_type); fs::inode::recompute(st); diff --git a/src/readlink.cpp b/src/readlink.cpp index b484b052..e5b4f486 100644 --- a/src/readlink.cpp +++ b/src/readlink.cpp @@ -28,13 +28,13 @@ using std::vector; using mergerfs::Policy; static -int +ssize_t _readlink_core(const string *basepath, const char *fusepath, char *buf, const size_t size) { - int rv; + ssize_t rv; string fullpath; fs::path::make(basepath,fusepath,fullpath); @@ -49,7 +49,7 @@ _readlink_core(const string *basepath, } static -int +ssize_t _readlink(Policy::Func::Search searchFunc, const vector &srcmounts, const uint64_t minfreespace, @@ -57,7 +57,7 @@ _readlink(Policy::Func::Search searchFunc, char *buf, const size_t size) { - int rv; + ssize_t rv; vector basepaths; rv = searchFunc(srcmounts,fusepath,minfreespace,basepaths); @@ -71,7 +71,7 @@ namespace mergerfs { namespace fuse { - int + ssize_t readlink(const char *fusepath, char *buf, size_t size) diff --git a/src/ugid_rwlock.hpp b/src/ugid_rwlock.hpp index 0c4dfd23..580a2ec8 100644 --- a/src/ugid_rwlock.hpp +++ b/src/ugid_rwlock.hpp @@ -48,13 +48,13 @@ namespace mergerfs if(currentuid != 0) { - ::seteuid(0); - ::setegid(0); + (void)::seteuid(0); + (void)::setegid(0); } if(newgid) { - ::setegid(newgid); + (void)::setegid(newgid); initgroups(newuid,newgid); } diff --git a/src/write.cpp b/src/write.cpp index 6d722b06..be1f5deb 100644 --- a/src/write.cpp +++ b/src/write.cpp @@ -26,7 +26,7 @@ using namespace mergerfs; -typedef int (*WriteFunc)(const int,const void*,const size_t,const off_t); +typedef ssize_t (*WriteFunc)(const int,const void*,const size_t,const off_t); static bool @@ -38,32 +38,30 @@ _out_of_space(const int error) static inline -int +ssize_t _write(const int fd, const void *buf, const size_t count, const off_t offset) { - int rv; + ssize_t rv; rv = fs::pwrite(fd,buf,count,offset); if(rv == -1) return -errno; - if(rv == 0) - return 0; - return count; + return rv; } static inline -int +ssize_t _write_direct_io(const int fd, const void *buf, const size_t count, const off_t offset) { - int rv; + ssize_t rv; rv = fs::pwrite(fd,buf,count,offset); if(rv == -1) @@ -81,7 +79,7 @@ namespace mergerfs { static inline - int + ssize_t write(WriteFunc func, const char *fusepath, const char *buf, @@ -89,11 +87,11 @@ namespace mergerfs const off_t offset, fuse_file_info *ffi) { - int rv; + ssize_t rv; FileInfo* fi = reinterpret_cast(ffi->fh); rv = func(fi->fd,buf,count,offset); - if(_out_of_space(-rv)) + if(_out_of_space((int)-rv)) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc); @@ -114,7 +112,7 @@ namespace mergerfs return rv; } - int + ssize_t write(const char *fusepath, const char *buf, size_t count, @@ -124,7 +122,7 @@ namespace mergerfs return write(_write,fusepath,buf,count,offset,ffi); } - int + ssize_t write_direct_io(const char *fusepath, const char *buf, size_t count, diff --git a/src/write_buf.cpp b/src/write_buf.cpp index db262436..44f08dff 100644 --- a/src/write_buf.cpp +++ b/src/write_buf.cpp @@ -46,7 +46,7 @@ _out_of_space(const int error) } static -int +ssize_t _write_buf(const int fd, fuse_bufvec &src, const off_t offset) @@ -67,17 +67,17 @@ namespace mergerfs { namespace fuse { - int + ssize_t write_buf(const char *fusepath, fuse_bufvec *src, off_t offset, fuse_file_info *ffi) { - int rv; + ssize_t rv; FileInfo *fi = reinterpret_cast(ffi->fh); rv = _write_buf(fi->fd,*src,offset); - if(_out_of_space(-rv)) + if(_out_of_space((int)-rv)) { const fuse_context *fc = fuse_get_context(); const Config &config = Config::get(fc);