summaryrefslogtreecommitdiff
path: root/tests/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/open.c')
-rw-r--r--tests/open.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/open.c b/tests/open.c
index 3fce327ba..5c7295395 100644
--- a/tests/open.c
+++ b/tests/open.c
@@ -15,6 +15,8 @@
# include <stdio.h>
# include <unistd.h>
+# include "secontext.h"
+
int
main(void)
{
@@ -25,10 +27,12 @@ main(void)
create_and_enter_subdir("open_subdir");
static const char sample[] = "open.sample";
+ char *my_secontext = SECONTEXT_PID_MY();
long fd = syscall(__NR_open, sample, O_RDONLY|O_CREAT, 0400);
- printf("open(\"%s\", O_RDONLY|O_CREAT, 0400) = %s\n",
- sample, sprintrc(fd));
+ printf("%s%s(\"%s\", O_RDONLY|O_CREAT, 0400) = %s%s\n",
+ my_secontext, "open",
+ sample, sprintrc(fd), SECONTEXT_FILE(sample));
if (fd != -1) {
close(fd);
@@ -36,16 +40,18 @@ main(void)
perror_msg_and_fail("unlink");
fd = syscall(__NR_open, sample, O_RDONLY);
- printf("open(\"%s\", O_RDONLY) = %s\n", sample, sprintrc(fd));
+ printf("%s%s(\"%s\", O_RDONLY) = %s\n",
+ my_secontext, "open", sample, sprintrc(fd));
fd = syscall(__NR_open, sample, O_WRONLY|O_NONBLOCK|0x80000000);
- printf("open(\"%s\", O_WRONLY|O_NONBLOCK|0x80000000) = %s\n",
- sample, sprintrc(fd));
+ printf("%s%s(\"%s\", O_WRONLY|O_NONBLOCK|0x80000000) = %s\n",
+ my_secontext, "open", sample, sprintrc(fd));
}
# ifdef O_TMPFILE
fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600);
- printf("open(\"%s\", O_WRONLY|O_TMPFILE, 0600) = %s\n",
+ printf("%s%s(\"%s\", O_WRONLY|O_TMPFILE, 0600) = %s\n",
+ my_secontext, "open",
sample, sprintrc(fd));
# endif /* O_TMPFILE */