Bug499183 - FreeBSD: differences in avx-vmovq output
[valgrind.git] / memcheck / tests / freebsd / statfs.c
blobf2a995324194c06b9eedb8b0b5414dde2fb9579c
1 #include <sys/param.h>
2 #include <sys/mount.h>
3 #include <fcntl.h>
4 #include <string.h>
5 #include <stdio.h>
6 #include <stdlib.h>
8 int main(void)
10 struct statfs fs;
11 int fd = open("/bin/sh", O_RDONLY);
13 // OK
14 if (-1 == statfs("/bin/sh", &fs)) {
15 perror("statfs failed:");
18 if (-1 == fstatfs(fd, &fs)) {
19 perror("statfs failed:");
22 struct statfs* pfs;
24 pfs = malloc(sizeof(struct statfs));
25 free(pfs);
27 // invalid write
28 statfs("/bin/sh", pfs);
29 pfs = malloc(sizeof(struct statfs));
30 free(pfs);
31 fstatfs(fd, pfs);
33 pfs = malloc(sizeof(struct statfs) - 3);
34 statfs("/bin/sh", pfs);
36 char* badstring = strdup("/bin/sh");
37 free(badstring);
39 statfs(badstring, &fs);
41 int badfd;
42 fstatfs(badfd, &fs);
44 free(pfs);