libtar: backup and restore posix capabilities
This patch also allows libtar to combine data from multiple extended
tar headers into a single header.
Change-Id: I82d13e89a3622ea665b60062b1904ddbedfa41b3
diff --git a/libtar/util.c b/libtar/util.c
index f472f38..7fb3f51 100644
--- a/libtar/util.c
+++ b/libtar/util.c
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <sys/param.h>
#include <errno.h>
+#include <linux/capability.h>
#ifdef STDC_HEADERS
# include <string.h>
@@ -210,3 +211,11 @@
}
int_to_oct(num, oct, octlen);
}
+
+void print_caps(struct vfs_cap_data *cap_data) {
+ printf(" magic_etc=%u \n", cap_data->magic_etc);
+ printf(" data[0].permitted=%u \n", cap_data->data[0].permitted);
+ printf(" data[0].inheritable=%u \n", cap_data->data[0].inheritable);
+ printf(" data[1].permitted=%u \n", cap_data->data[1].permitted);
+ printf(" data[1].inheritable=%u \n", cap_data->data[1].inheritable);
+}