diff options
author | Fred-Barclay <Fred-Barclay@users.noreply.github.com> | 2019-02-17 17:04:02 -0600 |
---|---|---|
committer | Fred-Barclay <Fred-Barclay@users.noreply.github.com> | 2019-02-17 17:04:02 -0600 |
commit | 6181f75e3f1b73708eaef7e22364ed0e9a1c482e (patch) | |
tree | f888a4871612a8b9f0ef9b8f7ae916aaf105f2be /test/filters | |
parent | merges (diff) | |
download | firejail-6181f75e3f1b73708eaef7e22364ed0e9a1c482e.tar.gz firejail-6181f75e3f1b73708eaef7e22364ed0e9a1c482e.tar.zst firejail-6181f75e3f1b73708eaef7e22364ed0e9a1c482e.zip |
Housekeeping
Make sure all files end with a newline
Strip extra newlines and trailing whitespace from files
Diffstat (limited to 'test/filters')
-rw-r--r-- | test/filters/memwrexe.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/filters/memwrexe.c b/test/filters/memwrexe.c index 7e14aa23d..b43b232d1 100644 --- a/test/filters/memwrexe.c +++ b/test/filters/memwrexe.c | |||
@@ -20,7 +20,7 @@ int main(int argc, char **argv) { | |||
20 | usage(); | 20 | usage(); |
21 | return 1; | 21 | return 1; |
22 | } | 22 | } |
23 | 23 | ||
24 | if (strcmp(argv[1], "mmap") == 0) { | 24 | if (strcmp(argv[1], "mmap") == 0) { |
25 | // open some file | 25 | // open some file |
26 | int fd = open("memwrexe.c", O_RDONLY); | 26 | int fd = open("memwrexe.c", O_RDONLY); |
@@ -28,13 +28,13 @@ int main(int argc, char **argv) { | |||
28 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); | 28 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); |
29 | return 1; | 29 | return 1; |
30 | } | 30 | } |
31 | 31 | ||
32 | int size = lseek(fd, 0, SEEK_END); | 32 | int size = lseek(fd, 0, SEEK_END); |
33 | if (size == -1) { | 33 | if (size == -1) { |
34 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); | 34 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); |
35 | return 1; | 35 | return 1; |
36 | } | 36 | } |
37 | 37 | ||
38 | void *p = mmap (0, size, PROT_WRITE|PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0); | 38 | void *p = mmap (0, size, PROT_WRITE|PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0); |
39 | printf("mmap successful\n"); | 39 | printf("mmap successful\n"); |
40 | 40 | ||
@@ -51,19 +51,19 @@ int main(int argc, char **argv) { | |||
51 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); | 51 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); |
52 | return 1; | 52 | return 1; |
53 | } | 53 | } |
54 | 54 | ||
55 | int size = lseek(fd, 0, SEEK_END); | 55 | int size = lseek(fd, 0, SEEK_END); |
56 | if (size == -1) { | 56 | if (size == -1) { |
57 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); | 57 | fprintf(stderr, "TESTING ERROR: file not found, cannot run mmap test\n"); |
58 | return 1; | 58 | return 1; |
59 | } | 59 | } |
60 | 60 | ||
61 | void *p = mmap (0, size, PROT_READ, MAP_SHARED, fd, 0); | 61 | void *p = mmap (0, size, PROT_READ, MAP_SHARED, fd, 0); |
62 | if (!p) { | 62 | if (!p) { |
63 | fprintf(stderr, "TESTING ERROR: cannot map file for mprotect test\n"); | 63 | fprintf(stderr, "TESTING ERROR: cannot map file for mprotect test\n"); |
64 | return 1; | 64 | return 1; |
65 | } | 65 | } |
66 | 66 | ||
67 | mprotect(p, size, PROT_READ|PROT_WRITE|PROT_EXEC); | 67 | mprotect(p, size, PROT_READ|PROT_WRITE|PROT_EXEC); |
68 | printf("mprotect successful\n"); | 68 | printf("mprotect successful\n"); |
69 | 69 | ||
@@ -73,4 +73,3 @@ int main(int argc, char **argv) { | |||
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | \ No newline at end of file | ||