--- lib/linuxattr.c +++ lib/linuxattr.c @@ -52,9 +52,7 @@ #include #endif -#ifdef HAVE_SYS_STATFS_H /* Nonexistant future OS needs this */ -#include -#endif +#include #ifdef HAVE_SYS_MOUNT_H #include @@ -138,7 +136,7 @@ #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LGETXATTR) && !defined(__APPLE__) char *i, *buf = NULL; int ret, retval=0, bufsz = 1024; - struct statfs sfs; + struct statvfs sfs; char *fsname = NULL; struct _linuxattr_context context; @@ -165,8 +163,9 @@ if( ret == 0 ) goto BAIL; memset(&sfs, 0, sizeof(sfs)); - statfs(file, &sfs); + statvfs(file, &sfs); +#if 0 switch(sfs.f_type) { case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */ case JFS_SUPER_MAGIC: fsname = "jfs" ; break; @@ -174,6 +173,15 @@ case XFS_SUPER_MAGIC: fsname = "xfs" ; break; default: retval=0; goto BAIL; }; +#endif + + fsname = sfs.f_fstypename; + + if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") && + strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) { + retval=0; + goto BAIL; + } for( i=buf; (i-buf) < ret; i += strlen(i)+1 ) { xar_ea_t e; @@ -202,7 +210,7 @@ { #if defined HAVE_SYS_XATTR_H && defined(HAVE_LSETXATTR) && !defined(__APPLE__) const char *fsname = "bogus"; - struct statfs sfs; + struct statvfs sfs; int eaopt = 0; struct _linuxattr_context context; xar_prop_t p; @@ -217,19 +225,31 @@ /* Check for EA extraction behavior */ memset(&sfs, 0, sizeof(sfs)); - if( statfs(file, &sfs) != 0 ) { + if( statvfs(file, &sfs) != 0 ) { char *tmp, *bname; tmp = strdup(file); bname = dirname(tmp); - statfs(bname, &sfs); + statvfs(bname, &sfs); free(tmp); } +#if 0 switch(sfs.f_type) { case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */ case JFS_SUPER_MAGIC: fsname = "jfs" ; break; case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break; case XFS_SUPER_MAGIC: fsname = "xfs" ; break; }; +#endif + + { + const char *pp = fsname; + fsname = sfs.f_fstypename; + + if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") && + strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) { + fsname = pp; + } + } for(p = xar_prop_pfirst(f); p; p = xar_prop_pnext(p)) { const char *fs = NULL;