From 40b119b990b33b5b76e5f09e4fbc844e5b1310fc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 4 Feb 2021 12:14:13 +0100 Subject: [PATCH] hardlink: check and use sys/xattr.h Signed-off-by: Karel Zak --- configure.ac | 1 + misc-utils/hardlink.c | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 72f25d307..a16e418e1 100644 --- a/configure.ac +++ b/configure.ac @@ -339,6 +339,7 @@ AC_CHECK_HEADERS([ \ sys/types.h \ sys/ucred.h \ sys/un.h \ + sys/xattr.h \ unistd.h \ utmp.h \ utmpx.h \ diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c index d888f7cb7..4b01fb336 100644 --- a/misc-utils/hardlink.c +++ b/misc-utils/hardlink.c @@ -23,7 +23,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - #define _POSIX_C_SOURCE 200112L /* POSIX functions */ #define _XOPEN_SOURCE 600 /* nftw() */ @@ -36,7 +35,6 @@ #include /* tsearch() and friends */ #include /* SIG*, sigaction */ #include /* getopt_long() */ - #include /* tolower() */ #include "nls.h" @@ -51,8 +49,8 @@ # include /* regcomp(), regsearch() */ #endif -#ifdef HAVE_XATTR -#include /* listxattr, getxattr */ +#ifdef HAVE_SYS_XATTR_H +# include /* listxattr, getxattr */ #endif /** @@ -318,7 +316,7 @@ static void print_stats(void) jlog(JLOG_SUMMARY, "Mode: %s", opts.dry_run ? "dry-run" : "real"); jlog(JLOG_SUMMARY, "Files: %zu", stats.files); jlog(JLOG_SUMMARY, "Linked: %zu files", stats.linked); -#ifdef HAVE_XATTR +#ifdef HAVE_SYS_XATTR_H jlog(JLOG_SUMMARY, "Compared: %zu xattrs", stats.xattr_comparisons); #endif jlog(JLOG_SUMMARY, "Compared: %zu files", stats.comparisons); @@ -347,7 +345,7 @@ static int handle_interrupt(void) return FALSE; } -#ifdef HAVE_XATTR +#ifdef HAVE_SYS_XATTR_H /** * malloc_or_die -- Wrapper for malloc() @@ -922,7 +920,7 @@ static int help(const char *name) puts(" -p, --ignore-mode Ignore changes of file mode"); puts(" -o, --ignore-owner Ignore owner changes"); puts(" -t, --ignore-time Ignore timestamps (when testing for equality)"); -#ifdef HAVE_XATTR +#ifdef HAVE_SYS_XATTR_H puts(" -X, --respect-xattrs Respect extended attributes"); #endif puts(" -m, --maximize Maximize the hardlink count, remove the file with");