]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
meson: handle fuse versions with buggy dt_type handling
authorChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Sun, 13 Mar 2022 11:00:34 +0000 (12:00 +0100)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Sun, 13 Mar 2022 11:14:25 +0000 (12:14 +0100)
Link: https://github.com/libfuse/libfuse/pull/591
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
meson.build
src/bindings.c
src/lxcfs_fuse_compat.h

index 2881defde8d4eedab4d3c0801bafaeb5dcbe6133..a9378cc5e7227dc66b59444801f485fa2afaddea 100644 (file)
@@ -150,11 +150,17 @@ libfuse = dependency('fuse3', required: false)
 if libfuse.found()
     conf.set10('HAVE_FUSE3', true)
     conf.set('FUSE_USE_VERSION', 35)
+    if libfuse.version().version_compare('>=3.10.3')
+       conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
+    else
+       conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', false)
+    endif
 else
     libfuse = dependency('fuse', version: '>= 2.6')
     if libfuse.found()
         conf.set10('HAVE_FUSE', true)
         conf.set('FUSE_USE_VERSION', 26)
+       conf.set10('HAVE_FUSE_RETURNS_DT_TYPE', true)
     endif
 endif
 
index e417a13a3558bf795f6c1096c2546b897feea1dd..422a6229dc1e78cffbaba391b4f5995500b7f464 100644 (file)
@@ -939,7 +939,9 @@ static void __attribute__((destructor)) lxcfs_exit(void)
 void *lxcfs_fuse_init(struct fuse_conn_info *conn, void *data)
 {
        struct fuse_context *fc = fuse_get_context();
+#if HAVE_FUSE_RETURNS_DT_TYPE
        can_use_sys_cpu = true;
+#endif
        has_versioned_opts = true;
        return fc->private_data;
 }
index 347f07390b0ddda56097069ef44299c85e2798d8..5337a54c787f296a60329dcea86b589240fbd3cb 100644 (file)
@@ -59,10 +59,10 @@ static inline int dir_fillerat(fuse_fill_dir_t filler, DIR *dp,
        int ret;
 
        ret = fstatat(dirfd(dp), name, &st, AT_SYMLINK_NOFOLLOW);
-       if (ret)
-               return DIR_FILLER(filler, buf, name, NULL, off);
+       if (!ret)
+               return DIR_FILLER(filler, buf, name, &st, off);
 
-       return DIR_FILLER(filler, buf, name, &st, off);
+       return DIR_FILLER(filler, buf, name, NULL, off);
 }
 
 #endif /* __LXCFS_FUSE_COMPAT_H */