[sheepdog] [PATCH] add early test for xattr support

Dietmar Maurer dietmar at proxmox.com
Wed Jul 18 12:12:59 CEST 2012


We want to detect that early and prevent startup. Else the daemon starts
and simply crash with panic() later.

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 sheep/sheep.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index b3a12e3..307d013 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -20,6 +20,7 @@
 #include <linux/limits.h>
 #include <sys/syslog.h>
 #include <sys/types.h>
+#include <sys/xattr.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -258,6 +259,11 @@ int main(int argc, char **argv)
 	if (ret)
 		exit(1);
 
+	if ((listxattr(dir, NULL, 0) == -1) && (errno == ENOTSUP)) {
+		fprintf(stderr, "missing xattr support on %s\n", dir);
+		exit(1);
+	}
+
 	ret = log_init(program_name, LOG_SPACE_SIZE, to_stdout, log_level, path);
 	if (ret)
 		exit(1);
-- 
1.7.2.5





More information about the sheepdog mailing list