@@ -52,11 +52,13 @@
#define FILENAME "fsetxattr02testfile"
#define DIRNAME "fsetxattr02testdir"
#define SYMLINK "fsetxattr02symlink"
-#define FIFO "fsetxattr02fifo"
-#define CHR "fsetxattr02chr"
-#define BLK "fsetxattr02blk"
+#define FIFO "/dev/fsetxattr02fifo"
+#define CHR "/dev/fsetxattr02chr"
+#define BLK "/dev/fsetxattr02blk"
#define SOCK "fsetxattr02sock"
+static char *dev_files[3] = {FIFO, CHR, BLK};
+
struct test_case {
char *fname;
int fd;
@@ -139,6 +141,9 @@ static struct test_case tc[] = {
static void verify_fsetxattr(unsigned int i)
{
+ /* acquire basename to avoid breaking OFFSET logic*/
+ tc[i].fname = strstr(tc[i].fname, "fsetxattr02");
+
/* some tests might require existing keys for each iteration */
if (tc[i].needskeyset) {
SAFE_FSETXATTR(tc[i].fd, tc[i].key, tc[i].value, tc[i].size,
@@ -240,6 +245,11 @@ static void cleanup(void)
if (tc[i].fd > 0)
SAFE_CLOSE(tc[i].fd);
}
+
+ for (i = 0; i < ARRAY_SIZE(dev_files); i++) {
+ if (!access(dev_files[i], F_OK))
+ SAFE_UNLINK(dev_files[i]);
+ }
}
static struct tst_test test = {
If temporary directory(TMPDIR/TEMPDIR) is on the mountpoint which is mounted with nodev option or temporary directory is mounted with with nodev option directly(e.g. tmpfs is mounted on /tmp), open(2) has no permission to open device files in the temporary directory and returns EACCES. as below: -------------------------------------------------------------------- safe_macros.c:225: BROK: fsetxattr02.c:215: open(fsetxattr02chr,0,00) failed: EACCES -------------------------------------------------------------------- We try to fix this issue by creating device files in /dev/ instead. This is the same issue reported by open11, please see the mail: http://lists.linux.it/pipermail/ltp/2018-July/008641.html Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Changes in v2: Acquire basename to avoid breaking OFFSET logic. --- testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)