aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/vm/pt-write-code-2.c
blob: 83bcc2c3b620e416f4736d013f3ce8b7af89b564 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* Try to write to the code segment using a system call.
   The process must be terminated with -1 exit code. */

#include "tests/lib.h"
#include "tests/main.h"

void
test_main (void)
{
  int handle;

  CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
  read (handle, (void *) test_main, 1);
  fail ("survived reading data into code segment");
}