This repository has been archived on 2021-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
OS/pintos-env/pintos/tests/filesys/extended/dir-open.c

22 lines
451 B
C
Raw Permalink Normal View History

/* Opens a directory, then tries to write to it, which must
fail. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int fd;
int retval;
CHECK (mkdir ("xyzzy"), "mkdir \"xyzzy\"");
CHECK ((fd = open ("xyzzy")) > 1, "open \"xyzzy\"");
msg ("write \"xyzzy\"");
retval = write (fd, "foobar", 6);
CHECK (retval == -1,
"write \"xyzzy\" (must return -1, actually %d)", retval);
}