[Libguestfs] [PATCH] Fix include for xattr.h

Richard W.M. Jones rjones at redhat.com
Fri Nov 23 08:30:41 UTC 2018


On Thu, Nov 22, 2018 at 11:55:24PM +0100, Martin Kletzander wrote:
> The proper file that should be included is `sys/xattr.h` as that comes from
> `glibc` and not `attr/xattr.h` which ships with the `attr` utility.
> 
> New enough `attr` utility (at least 2.4.48 in my case) even includes a #warning
> in `attr/xattr.h` for projects that still have this mistake in the code.

I think at some point we were trying to remain compatible with
something (RHEL 5 maybe?) which didn't have <sys/xattr.h>.  However
I've checked both RHEL 6 & 7 and they both have <sys/xattr.h> so I'll
ACK & push this patch.

Thanks,

Rich.

>  daemon/xattr.c          | 8 ++------
>  fuse/test-fuse.c        | 4 ----
>  lib/fuse.c              | 2 +-
>  m4/guestfs-libraries.m4 | 1 -
>  4 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/daemon/xattr.c b/daemon/xattr.c
> index bbe571b3f8bb..b10f6bddf4d0 100644
> --- a/daemon/xattr.c
> +++ b/daemon/xattr.c
> @@ -37,12 +37,8 @@
>  
>  #ifdef HAVE_LINUX_XATTRS
>  
> -# ifdef HAVE_ATTR_XATTR_H
> -#  include <attr/xattr.h>
> -# else
> -#  ifdef HAVE_SYS_XATTR_H
> -#   include <sys/xattr.h>
> -#  endif
> +# ifdef HAVE_SYS_XATTR_H
> +#  include <sys/xattr.h>
>  # endif
>  
>  int
> diff --git a/fuse/test-fuse.c b/fuse/test-fuse.c
> index 5ce8322f0d0e..ac0a49348a3a 100644
> --- a/fuse/test-fuse.c
> +++ b/fuse/test-fuse.c
> @@ -41,13 +41,9 @@
>  #include <acl/libacl.h>
>  #endif
>  
> -#ifdef HAVE_ATTR_XATTR_H
> -#include <attr/xattr.h>
> -#else
>  #ifdef HAVE_SYS_XATTR_H
>  #include <sys/xattr.h>
>  #endif
> -#endif
>  
>  #include <guestfs.h>
>  #include "guestfs-utils.h"
> diff --git a/lib/fuse.c b/lib/fuse.c
> index 1ac42330d3e7..52dc0bd99d11 100644
> --- a/lib/fuse.c
> +++ b/lib/fuse.c
> @@ -35,7 +35,7 @@
>  #endif
>  
>  #if HAVE_FUSE
> -/* See <attr/xattr.h> */
> +/* See <sys/xattr.h> */
>  #ifndef ENOATTR
>  #define ENOATTR ENODATA
>  #endif
> diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
> index 095dd38bf43b..6b2e8db9456d 100644
> --- a/m4/guestfs-libraries.m4
> +++ b/m4/guestfs-libraries.m4
> @@ -36,7 +36,6 @@ AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
>  
>  dnl Headers.
>  AC_CHECK_HEADERS([\
> -    attr/xattr.h \
>      byteswap.h \
>      endian.h \
>      sys/endian.h \
> -- 
> 2.19.1

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list