diff --git a/CMakeLists.txt b/CMakeLists.txt index a9319e323..891088789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,11 @@ if(UNAME) set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}") endif() +find_program(GETFATTR NAMES getfattr) +if(GETFATTR) + set(HAVE_GETFATTR TRUE) +endif() + # Define some Platforms if(osname MATCHES "CYGWIN.*") set(ISCYGWIN yes) diff --git a/config.h.cmake.in b/config.h.cmake.in index 4193b071a..fe7dabcdf 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -373,6 +373,9 @@ are set when opening a binary file on Windows. */ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CTYPE_H 1 +/* Define to 1 if you have the getfattr command line utility. */ +#cmakedefine HAVE_GETFATTR 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_XATTR_H diff --git a/configure.ac b/configure.ac index 13ca293bd..4f1602450 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,12 @@ AC_LANG_POP([C]) if test $have_no_strict_aliasing = no; then CFLAGS=$SAVE_CFLAGS fi + +## +# Check to see if we have getfattr +## +AC_CHECK_PROGS([HAVE_GETFATTR], [getfattr]) + ## # Some files need to exist in build directories # that do not correspond to their source directory, or diff --git a/libdispatch/dinfermodel.c b/libdispatch/dinfermodel.c index a68e222d8..a381ee008 100644 --- a/libdispatch/dinfermodel.c +++ b/libdispatch/dinfermodel.c @@ -1648,16 +1648,22 @@ fprintf(stderr,"@@@ %s=|%s|\n",p,xvalue); } } #else /*!HAVE_SYS_XATTR_H*/ + +#ifdef HAVE_GETFATTR { FILE *fp; char cmd[4096]; memset(cmd,0,sizeof(cmd)); - snprintf(cmd,sizeof(cmd),"getfattr %s | grep -c '.daos'",path); - if((fp = popen(cmd, "r")) != NULL) { - fscanf(fp, "%d", &rc); - pclose(fp); + snprintf(cmd,sizeof(cmd),"getfattr %s | grep -c '.daos'",path); + if((fp = popen(cmd, "r")) != NULL) { + fscanf(fp, "%d", &rc); + pclose(fp); } - } + } +#else /*!HAVE_GETFATTR*/ + /* We just can't test for DAOS container.*/ + stat = 0; +#endif /*HAVE_GETFATTR*/ #endif /*HAVE_SYS_XATTR_H*/ } /* Test for DAOS container */