blob: 29d18b8580eb5a48fe59d1a77a1758dfb9a8c363 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* 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);
}
|