merge from the autoconf2 branch to the main branch
[samba.git] / source / tests / ftruncate.c
1 /* test whether ftruncte() can extend a file */
2
3 #include <unistd.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7
8 #define DATA "conftest.trunc"
9 #define LEN 7663
10
11 main()
12 {
13         int *buf;
14         int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
15
16         ftruncate(fd, LEN);
17
18         unlink(DATA);
19
20         if (lseek(fd, 0, SEEK_END) == LEN) {
21                 exit(0);
22         }
23         exit(1);
24 }