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

Martin Kletzander mkletzan at redhat.com
Thu Nov 22 22:55:24 UTC 2018


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.
---
 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




More information about the Libguestfs mailing list