diff --git a/m4.include/ac-get-fs-info.m4 b/m4.include/ac-get-fs-info.m4 index 5f25b4c82..97b64dae2 100644 --- a/m4.include/ac-get-fs-info.m4 +++ b/m4.include/ac-get-fs-info.m4 @@ -628,6 +628,11 @@ AC_DEFUN([gl_FSTYPENAME], #include #include ]) + AC_CHECK_MEMBERS([struct statvfs.f_fstypename, struct statvfs.f_basetype],,, + [ + AC_INCLUDES_DEFAULT + #include + ]) ]) dnl diff --git a/src/filegui.c b/src/filegui.c index ac706b1e0..15b3872d8 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -55,19 +55,23 @@ #include #include -#if defined (__FreeBSD__) +#if defined(STAT_STATVFS) \ + && (defined(HAVE_STRUCT_STATVFS_F_BASETYPE) \ + || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)) +# include +# define STRUCT_STATFS struct statvfs +# define STATFS statvfs +#elif defined(HAVE_STATFS) && !defined(STAT_STATFS4) +# ifdef HAVE_SYS_VFS_H +# include +# elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_SYS_PARAM_H) # include -#endif -#if defined(__APPLE__) || defined (__FreeBSD__) # include -#elif defined (__NetBSD__) -# include -#else -# ifdef HAVE_VFS -# include -# else -# include -# endif +# elif defined(HAVE_SYS_STATFS_H) +# include +# endif +# define STRUCT_STATFS struct statfs +# define STATFS statfs #endif #include @@ -164,14 +168,16 @@ enum { static int filegui__check_attrs_on_fs(const char *fs_path) { - struct statfs stfs; +#ifdef STATFS + STRUCT_STATFS stfs; if (!setup_copymove_persistent_attr) return 0; - if (statfs(fs_path, &stfs)!=0) + if (STATFS(fs_path, &stfs)!=0) return 1; +# ifdef __linux__ switch ((filegui_nonattrs_fs_t) stfs.f_type) { case MSDOS_SUPER_MAGIC: @@ -184,6 +190,25 @@ filegui__check_attrs_on_fs(const char *fs_path) return 0; break; } +# elif defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) \ + || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) + if (!strcmp(stfs.f_fstypename, "msdos") + || !strcmp(stfs.f_fstypename, "msdosfs") + || !strcmp(stfs.f_fstypename, "ntfs") + || !strcmp(stfs.f_fstypename, "procfs") + || !strcmp(stfs.f_fstypename, "smbfs") + || strstr(stfs.f_fstypename, "fusefs")) + return 0; +# elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) + if (!strcmp(stfs.f_basetype, "pcfs") + || !strcmp(stfs.f_basetype, "ntfs") + || !strcmp(stfs.f_basetype, "proc") + || !strcmp(stfs.f_basetype, "smbfs") + || !strcmp(stfs.f_basetype, "fuse")) + return 0; +# endif +#endif /* STATFS */ + return 1; }