summaryrefslogtreecommitdiff
path: root/test/skodic.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2009-02-25 14:24:02 +0000
committerDenys Vlasenko <dvlasenk@redhat.com>2009-02-25 14:24:02 +0000
commit8ed57276426392f961d557ea0bf54d9ba6ac4a5f (patch)
treec1acf8718735dbc42a420f5fb41eca364f86eff1 /test/skodic.c
parent4dedd561d61562fe66f1a0b673ad33ac6a1e3c71 (diff)
downloadstrace-8ed57276426392f961d557ea0bf54d9ba6ac4a5f.tar.gz
strace-8ed57276426392f961d557ea0bf54d9ba6ac4a5f.tar.bz2
strace-8ed57276426392f961d557ea0bf54d9ba6ac4a5f.tar.xz
By Hans-Christian Egtvedt (hans-christian.egtvedt AT atmel.com):
strace.c: suppress "warning: unused static" message by adding #ifdef's around a variable .gitignore: trivial test/*.c: cleanup (suppress warnings, much better style).
Diffstat (limited to 'test/skodic.c')
-rw-r--r--test/skodic.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/test/skodic.c b/test/skodic.c
index 1495578..09967bd 100644
--- a/test/skodic.c
+++ b/test/skodic.c
@@ -6,28 +6,33 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-int
-main(void)
+int main(int argc, char *argv[])
{
- char *c = (char*)0x94000000;
- int fd;
- open( "/tmp/delme", O_RDWR );
- mmap( c, 4096, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, 3, 0 );
- *c = 0;
- if (fork()) {
- while(1) {
- strcpy( c, "/etc/passwd" );
- strcpy( c, "/etc/shadow" );
- }
- } else
- while (1)
- if ((fd=open( c, 0 ))!=-1)
- close(fd);
- return 0;
+ /* XXX: x86 specific stuff? */
+ char *c = (char*) 0x94000000;
+ int fd;
+
+ open("/tmp/delme", O_RDWR);
+ mmap(c, 4096, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, 3, 0);
+ *c = 0;
+
+ if (fork()) {
+ while(1) {
+ strcpy(c, "/etc/passwd");
+ strcpy(c, "/etc/shadow");
+ }
+ } else {
+ while (1)
+ if ((fd = open(c, 0)) != -1)
+ close(fd);
+ }
+
+ return 0;
}