summaryrefslogtreecommitdiffstats
path: root/src/tests/userprog/write-bad-ptr.c
blob: 533647900bfd21a8b7b09b6f32e0dee4fb62c8f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Passes an invalid pointer to the write system call.
   The process must be terminated with -1 exit code. */

#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"

void
test_main (void) 
{
  int handle;
  CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");

  write (handle, (char *) 0x10123420, 123);
  fail ("should have exited with -1");
}