Use correct headers/libraries when providing xattr support

See https://savannah.gnu.org/patch/index.php?8252. Patch provided
by Anthony G. Basile.

* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Look for <sys/xattr.h>
first and then for <attr/xattr.h>.  Link against libattr.so if
needed.
* lib/xattr-at.h: Include sys/xattr.h or attr/xattr.h, depending
on which one is detected.
* src/Makefile.am [TAR_LIB_ATTR] (tar_LDADD): Link against -lattr.
This commit is contained in:
Sergey Poznyakoff
2014-02-14 10:55:26 +02:00
parent 46da9968df
commit 48a546b02c
3 changed files with 40 additions and 6 deletions

View File

@@ -20,7 +20,15 @@
#define XATTRS_AT_H
#include <sys/types.h>
#include <attr/xattr.h>
#if defined(HAVE_SYS_XATTR_H)
# include <sys/xattr.h>
#elif defined(HAVE_ATTR_XATTR_H)
# include <attr/xattr.h>
#endif
#ifndef ENOATTR
# define ENOATTR ENODATA /* No such attribute */
#endif
/* These are the dir-fd-relative variants of the functions without the
"at" suffix. For example, setxattrat (AT_FDCWD, path, name, value, size,