hardlink: check and use sys/xattr.h

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-02-04 12:14:13 +01:00
parent 43989bad9e
commit 40b119b990
2 changed files with 6 additions and 7 deletions

View File

@ -339,6 +339,7 @@ AC_CHECK_HEADERS([ \
sys/types.h \ sys/types.h \
sys/ucred.h \ sys/ucred.h \
sys/un.h \ sys/un.h \
sys/xattr.h \
unistd.h \ unistd.h \
utmp.h \ utmp.h \
utmpx.h \ utmpx.h \

View File

@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#define _POSIX_C_SOURCE 200112L /* POSIX functions */ #define _POSIX_C_SOURCE 200112L /* POSIX functions */
#define _XOPEN_SOURCE 600 /* nftw() */ #define _XOPEN_SOURCE 600 /* nftw() */
@ -36,7 +35,6 @@
#include <search.h> /* tsearch() and friends */ #include <search.h> /* tsearch() and friends */
#include <signal.h> /* SIG*, sigaction */ #include <signal.h> /* SIG*, sigaction */
#include <getopt.h> /* getopt_long() */ #include <getopt.h> /* getopt_long() */
#include <ctype.h> /* tolower() */ #include <ctype.h> /* tolower() */
#include "nls.h" #include "nls.h"
@ -51,7 +49,7 @@
# include <regex.h> /* regcomp(), regsearch() */ # include <regex.h> /* regcomp(), regsearch() */
#endif #endif
#ifdef HAVE_XATTR #ifdef HAVE_SYS_XATTR_H
# include <sys/xattr.h> /* listxattr, getxattr */ # include <sys/xattr.h> /* listxattr, getxattr */
#endif #endif
@ -318,7 +316,7 @@ static void print_stats(void)
jlog(JLOG_SUMMARY, "Mode: %s", opts.dry_run ? "dry-run" : "real"); jlog(JLOG_SUMMARY, "Mode: %s", opts.dry_run ? "dry-run" : "real");
jlog(JLOG_SUMMARY, "Files: %zu", stats.files); jlog(JLOG_SUMMARY, "Files: %zu", stats.files);
jlog(JLOG_SUMMARY, "Linked: %zu files", stats.linked); 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); jlog(JLOG_SUMMARY, "Compared: %zu xattrs", stats.xattr_comparisons);
#endif #endif
jlog(JLOG_SUMMARY, "Compared: %zu files", stats.comparisons); jlog(JLOG_SUMMARY, "Compared: %zu files", stats.comparisons);
@ -347,7 +345,7 @@ static int handle_interrupt(void)
return FALSE; return FALSE;
} }
#ifdef HAVE_XATTR #ifdef HAVE_SYS_XATTR_H
/** /**
* malloc_or_die -- Wrapper for malloc() * 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(" -p, --ignore-mode Ignore changes of file mode");
puts(" -o, --ignore-owner Ignore owner changes"); puts(" -o, --ignore-owner Ignore owner changes");
puts(" -t, --ignore-time Ignore timestamps (when testing for equality)"); 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"); puts(" -X, --respect-xattrs Respect extended attributes");
#endif #endif
puts(" -m, --maximize Maximize the hardlink count, remove the file with"); puts(" -m, --maximize Maximize the hardlink count, remove the file with");