Skip to contentSkip to conversation

syscalls/getxattr03: new testcase to test getxattr(2)

PATCH Superseded Eryu Guan 2 participants 5 messages Jan 12, 2012 – Jan 19, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/2 syscalls/getxattr03: new testcase to test getxattr(2)

An empty buffer of size zero can be passed into getxattr(2) to return the current size of the named extended attribute.

---
 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/getxattr/getxattr03.c |  122 +++++++++++++++++++++++
 2 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/getxattr/getxattr03.c
runtest/syscalls +1 -0
index 4aac38c..d786746 100644
@@ -423,6 +423,7 @@ getuid03_16 getuid03_16
 
 getxattr01 getxattr01
 getxattr02 getxattr02
+getxattr03 getxattr03
 
 #Needs tty device.
 #ioctl01 ioctl01 -D /dev/tty0
testcases/kernel/syscalls/getxattr/getxattr03.c new file +122 -0

122 lines not on this page · raw message

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#1 lore raw

PATCH 2/2 syscalls/setxattr03: net testcase to test setxattr(2)

setxattr(2) to immutable and append-only files should get EPERM

There are 2 test cases:
1. Set attribute to a immutable file, setxattr(2) should return -1 and set errno to EPERM
2. Set attribute to a append-only file, setxattr(2) should return -1 and set errno to EPERM

---
 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/setxattr/setxattr03.c |  222 +++++++++++++++++++++++
 2 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/setxattr/setxattr03.c
runtest/syscalls +1 -0
index d786746..37dfc7e 100644
@@ -1027,6 +1027,7 @@ setuid04_16 setuid04_16
 
 setxattr01 setxattr01
 setxattr02 setxattr02
+setxattr03 setxattr03
 
 shmat01 shmat01
 shmat02 shmat02
testcases/kernel/syscalls/setxattr/setxattr03.c new file +222 -0

222 lines not on this page · raw message

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw

Re: [LTP] [PATCH 2/2] syscalls/setxattr03: net testcase to test setxattr(2)

Hi,

Quoted 8 lines · Eryu Guan

setxattr(2) to immutable and append-only files should get EPERM

There are 2 test cases:
1. Set attribute to a immutable file, setxattr(2) should return -1 and set errno to EPERM
2. Set attribute to a append-only file, setxattr(2) should return -1 and set errno to EPERM

Any comments on the two patches?

Thanks,
Eryu Guan

Quoted 239 lines
---
 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/setxattr/setxattr03.c |  222 +++++++++++++++++++++++
 2 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/setxattr/setxattr03.c
runtest/syscalls +1 -0
index d786746..37dfc7e 100644
@@ -1027,6 +1027,7 @@ setuid04_16 setuid04_16
 
 setxattr01 setxattr01
 setxattr02 setxattr02
+setxattr03 setxattr03
 
 shmat01 shmat01
 shmat02 shmat02
testcases/kernel/syscalls/setxattr/setxattr03.c new file +212 -0
new file mode 100644
index 0000000..223bff7
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like.  Any license provided herein, whether
+ * implied or otherwise, applies only to this software file.  Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/*
+ * setxattr(2) to immutable and append-only files should get EPERM
+ *
+ * There are 2 test cases:
+ * 1. Set attribute to a immutable file, setxattr(2) should return -1
+ *    and set errno to EPERM
+ * 2. Set attribute to a append-only file, setxattr(2) should return
+ *    -1 and set errno to EPERM
+ */
+
+#include "config.h"
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
+#include <linux/fs.h>
+
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "setxattr03";
+
+#ifdef HAVE_ATTR_XATTR_H
+#define XATTR_TEST_KEY "user.testkey"
+#define XATTR_TEST_VALUE "this is a test value"
+#define XATTR_TEST_VALUE_SIZE 20
+
+#define IMMU_FILE "setxattr03immutable"
+#define APPEND_FILE  "setxattr03appendonly"
+
+#define set_immutable_on(fd) fsetflag(fd, 1, 1)
+#define set_immutable_off(fd) fsetflag(fd, 0, 1)
+#define set_append_on(fd) fsetflag(fd, 1, 0)
+#define set_append_off(fd) fsetflag(fd, 0, 0)
+
+struct test_case {
+	char *desc;
+	char *fname;
+	char *key;
+	char *value;
+	size_t size;
+	int flags;
+	int exp_err;
+};
+static struct test_case tc[] = {
+	{	/* case 00, set attr to immutable file */
+		.desc = "Set attr to immutable file",
+		.fname = IMMU_FILE,
+		.key = XATTR_TEST_KEY,
+		.value = XATTR_TEST_VALUE,
+		.size = XATTR_TEST_VALUE_SIZE,
+		.flags = XATTR_CREATE,
+		.exp_err = EPERM,
+	},
+	{	/* case 01, set attr to append-only file */
+		.desc = "Set attr to append-only file",
+		.fname = APPEND_FILE,
+		.key = XATTR_TEST_KEY,
+		.value = XATTR_TEST_VALUE,
+		.size = XATTR_TEST_VALUE_SIZE,
+		.flags = XATTR_CREATE,
+		.exp_err = EPERM,
+	},
+};
+
+static void setup(void);
+static void cleanup(void);
+
+static int immu_fd;
+static int append_fd;
+
+int TST_TOTAL = sizeof(tc) / sizeof(tc[0]);
+
+int main(int argc, char *argv[])
+{
+	int lc;
+	int i;
+	char *msg;
+
+	msg = parse_opts(argc, argv, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		Tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++)	{
+			TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value,
+			    tc[i].size, tc[i].flags));
+
+			if (TEST_ERRNO == tc[i].exp_err) {
+				tst_resm(TPASS | TTERRNO, tc[i].desc);
+			} else {
+				tst_resm(TFAIL | TTERRNO, "%s - expected errno"
+				    " %d - Got", tc[i].desc, tc[i].exp_err);
+			}
+		}
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+static int fsetflag(int fd, int on, int immutable)
+{
+	int fsflags = 0;
+	int fsfl;
+
+	if (ioctl(fd, FS_IOC_GETFLAGS, &fsflags) < 0)
+		return 1;
+
+	if (immutable)
+		fsfl = FS_IMMUTABLE_FL;
+	else
+		fsfl = FS_APPEND_FL;
+
+	if (on)
+		fsflags |= fsfl;
+	else
+		fsflags &= ~fsfl;
+
+	if (ioctl(fd, FS_IOC_SETFLAGS, &fsflags) < 0)
+		return 1;
+
+	return 0;
+}
+
+static void setup(void)
+{
+	int fd;
+
+	tst_require_root(NULL);
+
+	tst_tmpdir();
+
+	/* Test for xattr support */
+	fd = creat("testfile", 0644);
+	if (fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create testfile failed");
+	close(fd);
+	if (setxattr("testfile", "user.test", "test", 4, XATTR_CREATE) == -1)
+		if (errno == ENOTSUP)
+			tst_brkm(TCONF, cleanup, "No xattr support in fs or "
+			    "mount without user_xattr option");
+	unlink("testfile");
+
+	/* Create test files and set file immutable or append-only */
+	immu_fd = creat(IMMU_FILE, 0644);
+	if (immu_fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create test file(%s) failed",
+		    IMMU_FILE);
+	if (set_immutable_on(immu_fd))
+		tst_brkm(TBROK | TERRNO, cleanup, "Set %s immutable failed",
+		    IMMU_FILE);
+
+	append_fd = creat(APPEND_FILE, 0644);
+	if (append_fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create test file(%s) failed",
+		    APPEND_FILE);
+	if (set_append_on(append_fd))
+		tst_brkm(TBROK | TERRNO, cleanup, "Set %s append-only failed",
+		    APPEND_FILE);
+
+	TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+	if (set_immutable_off(immu_fd))
+		tst_resm(TWARN | TERRNO, "Unset %s immutable failed",
+		    IMMU_FILE);
+	if (set_append_off(append_fd))
+		tst_resm(TWARN | TERRNO, "Unset %s append-only failed",
+		    APPEND_FILE);
+	close(immu_fd);
+	close(append_fd);

testcases/kernel/syscalls/setxattr/setxattr03.c line 222

Quoted 10 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +10 -0
+
+	TEST_CLEANUP;
+	tst_rmdir();
+}
+#else /* HAVE_ATTR_XATTR_H */
+int main(int argc, char *argv[])
+{
+	tst_brkm(TCONF, NULL, "<attr/xattr.h> does not exist.");
+}
+#endif /* HAVE_ATTR_XATTR_H */

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw

Re: [LTP] [PATCH 2/2] syscalls/setxattr03: net testcase to test setxattr(2)

In reply to Eryu Guan

Hi!

Quoted 84 lines

setxattr(2) to immutable and append-only files should get EPERM

There are 2 test cases:
1. Set attribute to a immutable file, setxattr(2) should return -1 and set errno to EPERM
2. Set attribute to a append-only file, setxattr(2) should return -1 and set errno to EPERM

---
 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/setxattr/setxattr03.c |  222 +++++++++++++++++++++++
 2 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/setxattr/setxattr03.c
runtest/syscalls +1 -0
index d786746..37dfc7e 100644
@@ -1027,6 +1027,7 @@ setuid04_16 setuid04_16
 
 setxattr01 setxattr01
 setxattr02 setxattr02
+setxattr03 setxattr03
 
 shmat01 shmat01
 shmat02 shmat02
testcases/kernel/syscalls/setxattr/setxattr03.c new file +50 -0
new file mode 100644
index 0000000..223bff7
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like.  Any license provided herein, whether
+ * implied or otherwise, applies only to this software file.  Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/*
+ * setxattr(2) to immutable and append-only files should get EPERM
+ *
+ * There are 2 test cases:
+ * 1. Set attribute to a immutable file, setxattr(2) should return -1
+ *    and set errno to EPERM
+ * 2. Set attribute to a append-only file, setxattr(2) should return
+ *    -1 and set errno to EPERM
+ */
+
+#include "config.h"
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
+#include <linux/fs.h>

testcases/kernel/syscalls/setxattr/setxattr03.c line 60

Quoted 10 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +10 -0
+
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "setxattr03";
+
+#ifdef HAVE_ATTR_XATTR_H
+#define XATTR_TEST_KEY "user.testkey"
+#define XATTR_TEST_VALUE "this is a test value"
+#define XATTR_TEST_VALUE_SIZE 20

This one could be defined as (sizeof(XATTR_TEST_VALUE) - 1) as well, or couldn't?

Quoted 109 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +109 -0
+#define IMMU_FILE "setxattr03immutable"
+#define APPEND_FILE  "setxattr03appendonly"
+
+#define set_immutable_on(fd) fsetflag(fd, 1, 1)
+#define set_immutable_off(fd) fsetflag(fd, 0, 1)
+#define set_append_on(fd) fsetflag(fd, 1, 0)
+#define set_append_off(fd) fsetflag(fd, 0, 0)
+
+struct test_case {
+	char *desc;
+	char *fname;
+	char *key;
+	char *value;
+	size_t size;
+	int flags;
+	int exp_err;
+};
+static struct test_case tc[] = {
+	{	/* case 00, set attr to immutable file */
+		.desc = "Set attr to immutable file",
+		.fname = IMMU_FILE,
+		.key = XATTR_TEST_KEY,
+		.value = XATTR_TEST_VALUE,
+		.size = XATTR_TEST_VALUE_SIZE,
+		.flags = XATTR_CREATE,
+		.exp_err = EPERM,
+	},
+	{	/* case 01, set attr to append-only file */
+		.desc = "Set attr to append-only file",
+		.fname = APPEND_FILE,
+		.key = XATTR_TEST_KEY,
+		.value = XATTR_TEST_VALUE,
+		.size = XATTR_TEST_VALUE_SIZE,
+		.flags = XATTR_CREATE,
+		.exp_err = EPERM,
+	},
+};
+
+static void setup(void);
+static void cleanup(void);
+
+static int immu_fd;
+static int append_fd;
+
+int TST_TOTAL = sizeof(tc) / sizeof(tc[0]);
+
+int main(int argc, char *argv[])
+{
+	int lc;
+	int i;
+	char *msg;
+
+	msg = parse_opts(argc, argv, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		Tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++)	{
+			TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value,
+			    tc[i].size, tc[i].flags));
+
+			if (TEST_ERRNO == tc[i].exp_err) {
+				tst_resm(TPASS | TTERRNO, tc[i].desc);
+			} else {
+				tst_resm(TFAIL | TTERRNO, "%s - expected errno"
+				    " %d - Got", tc[i].desc, tc[i].exp_err);
+			}
+		}
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+static int fsetflag(int fd, int on, int immutable)
+{
+	int fsflags = 0;
+	int fsfl;
+
+	if (ioctl(fd, FS_IOC_GETFLAGS, &fsflags) < 0)
+		return 1;
+
+	if (immutable)
+		fsfl = FS_IMMUTABLE_FL;
+	else
+		fsfl = FS_APPEND_FL;
+
+	if (on)
+		fsflags |= fsfl;
+	else
+		fsflags &= ~fsfl;
+
+	if (ioctl(fd, FS_IOC_SETFLAGS, &fsflags) < 0)
+		return 1;
+
+	return 0;
+}
+
+static void setup(void)
+{
+	int fd;
+
+	tst_require_root(NULL);
+
+	tst_tmpdir();

testcases/kernel/syscalls/setxattr/setxattr03.c line 180

Quoted 10 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +10 -0
+
+	/* Test for xattr support */
+	fd = creat("testfile", 0644);
+	if (fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create testfile failed");
+	close(fd);
+	if (setxattr("testfile", "user.test", "test", 4, XATTR_CREATE) == -1)
+		if (errno == ENOTSUP)
+			tst_brkm(TCONF, cleanup, "No xattr support in fs or "
+			    "mount without user_xattr option");

Here as mounted well.

Quoted 42 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +42 -0
+	unlink("testfile");
+
+	/* Create test files and set file immutable or append-only */
+	immu_fd = creat(IMMU_FILE, 0644);
+	if (immu_fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create test file(%s) failed",
+		    IMMU_FILE);
+	if (set_immutable_on(immu_fd))
+		tst_brkm(TBROK | TERRNO, cleanup, "Set %s immutable failed",
+		    IMMU_FILE);
+
+	append_fd = creat(APPEND_FILE, 0644);
+	if (append_fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create test file(%s) failed",
+		    APPEND_FILE);
+	if (set_append_on(append_fd))
+		tst_brkm(TBROK | TERRNO, cleanup, "Set %s append-only failed",
+		    APPEND_FILE);
+
+	TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+	if (set_immutable_off(immu_fd))
+		tst_resm(TWARN | TERRNO, "Unset %s immutable failed",
+		    IMMU_FILE);
+	if (set_append_off(append_fd))
+		tst_resm(TWARN | TERRNO, "Unset %s append-only failed",
+		    APPEND_FILE);
+	close(immu_fd);
+	close(append_fd);
+
+	TEST_CLEANUP;
+	tst_rmdir();
+}
+#else /* HAVE_ATTR_XATTR_H */
+int main(int argc, char *argv[])
+{
+	tst_brkm(TCONF, NULL, "<attr/xattr.h> does not exist.");
+}
+#endif /* HAVE_ATTR_XATTR_H */
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#4 lore raw
In reply to Eryu Guan

Hi!

Quoted 36 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +36 -0
+#include "config.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "getxattr03";
+
+#ifdef HAVE_ATTR_XATTR_H
+#define XATTR_TEST_KEY "user.testkey"
+#define XATTR_TEST_VALUE "test value"
+#define TESTFILE "getxattr03testfile"
+
+static void setup(void);
+static void cleanup(void);
+
+int TST_TOTAL = 1;
+
+int main(int argc, char *argv[])
+{
+	int lc;
+	char *msg;
+
+	msg = parse_opts(argc, argv, NULL, NULL);
+	if (msg != NULL)

testcases/kernel/syscalls/getxattr/getxattr03.c line 75

Quoted 10 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +10 -0
+		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		Tst_count = 0;
+
+		TEST(getxattr(TESTFILE, XATTR_TEST_KEY, NULL, 0));
+
+		if (TEST_RETURN == strlen(XATTR_TEST_VALUE))

You could use sizeof(XATTR_TEST_VALUE) - 1, which would be computed at compile time.

Quoted 15 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +15 -0
+			tst_resm(TPASS, "getxattr(2) returned correct value");
+		else
+			tst_resm(TFAIL | TTERRNO, "getxattr(2) failed");
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+static void setup(void)
+{
+	int fd;
+
+	tst_require_root(NULL);
+

testcases/kernel/syscalls/getxattr/getxattr03.c line 100

Quoted 10 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +10 -0
+	tst_tmpdir();
+
+	/* Test for xattr support and set attr value */
+	fd = creat(TESTFILE, 0644);
+	if (fd == -1)
+		tst_brkm(TBROK | TERRNO, cleanup, "Create %s failed", TESTFILE);
+	close(fd);
+
+	if (setxattr(TESTFILE, XATTR_TEST_KEY, XATTR_TEST_VALUE,
+	    strlen(XATTR_TEST_VALUE), XATTR_CREATE) == -1) {

Here too.

testcases/kernel/syscalls/getxattr/getxattr03.c line 103

Quoted 3 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +3 -0
+		if (errno == ENOTSUP)
+			tst_brkm(TCONF, cleanup, "No xattr support in fs or "
+			    "mount without user_xattr option");

Should rather say ... of fs mounted without ...

Quoted 19 lines
testcases/kernel/syscalls/getxattr/getxattr03.c new file +19 -0
+		else
+			tst_brkm(TBROK | TERRNO, cleanup, "setxattr %s failed",
+			    TESTFILE);
+	}
+
+	TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+	TEST_CLEANUP;
+	tst_rmdir();
+}
+#else /* HAVE_ATTR_XATTR_H */
+int main(int argc, char *argv[])
+{
+	tst_brkm(TCONF, NULL, "<attr/xattr.h> does not exist.");
+}
+#endif
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list