summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2014-05-29 14:31:42 +0100
committerBen Brewer <ben.brewer@codethink.co.uk>2014-05-29 15:49:22 +0100
commit9ba7d209f4447b4203a1d665d140e09a288ecad0 (patch)
treec39feb2d0cc759d8d8810d75f749ab7315584d35
parent073c8a339ae314c2b674a56f4c3f16c3142242a1 (diff)
downloadtbdiff-9ba7d209f4447b4203a1d665d140e09a288ecad0.tar.gz
Use sys/xattr from libc if attr/xattr is unavailable
On my system tbdiff failed to build because attr/xattr doesn't exist, also the attr package was not easy to find. On searching I discovered that the functionality we use in attr.h is provided by modern versions of libc, as shown here: https://bugzilla.kernel.org/show_bug.cgi?id=70141 This patch falls back to using libc sys/xattr.h when attr/xattr.h is unavailable.
-rw-r--r--tbdiff/tbdiff-apply.c8
-rw-r--r--tbdiff/tbdiff-xattrs.c9
2 files changed, 15 insertions, 2 deletions
diff --git a/tbdiff/tbdiff-apply.c b/tbdiff/tbdiff-apply.c
index e281d73..4f823e4 100644
--- a/tbdiff/tbdiff-apply.c
+++ b/tbdiff/tbdiff-apply.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Codethink Ltd.
+ * Copyright (C) 2011-2014 Codethink Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
@@ -29,7 +29,13 @@
#include <unistd.h>
#include <utime.h>
+#include <config.h>
+
+#if HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
+#else
+#include <sys/xattr.h>
+#endif
#include <tbdiff/tbdiff-common.h>
#include <tbdiff/tbdiff-io.h>
diff --git a/tbdiff/tbdiff-xattrs.c b/tbdiff/tbdiff-xattrs.c
index 95d263f..ad3848d 100644
--- a/tbdiff/tbdiff-xattrs.c
+++ b/tbdiff/tbdiff-xattrs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2012 Codethink Ltd.
+ * Copyright (C) 2011-2014 Codethink Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
@@ -18,7 +18,14 @@
#include <string.h>
#include <stdlib.h>
+#include <config.h>
+
+#if HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
+#else
+#include <sys/xattr.h>
+#endif
+
#include <errno.h>
#include <tbdiff/tbdiff-common.h>