summaryrefslogtreecommitdiff
path: root/test/mmap/mmap2.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-01-16 03:50:04 -0500
committerMike Frysinger <vapier@gentoo.org>2012-01-16 15:55:10 -0500
commit386a22b920780077d882e051689e6a3a6c92682b (patch)
treeeb37ef53e5ab0cc143de6a9b1fb8f7e431324c1c /test/mmap/mmap2.c
parent94bf930db1cd171ff5eb6e83bf8f593d0cde123a (diff)
tests: mmap2: ignore permission denied errors on /dev/mem
Non-root users can't open /dev/mem, so it makes it hard to pass. Ignore that case. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'test/mmap/mmap2.c')
-rw-r--r--test/mmap/mmap2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/mmap/mmap2.c b/test/mmap/mmap2.c
index b9a8f9ac4..8b94c6199 100644
--- a/test/mmap/mmap2.c
+++ b/test/mmap/mmap2.c
@@ -25,7 +25,12 @@ int main(int argc, char **argv) {
void* map_base = 0;
int fd;
off_t target = 0xfffff000;
- if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
+ if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
+ /* skip test for non-root users */
+ if (errno == EACCES)
+ return 0;
+ FATAL;
+ }
printf("/dev/mem opened.\n");
fflush(stdout);