00001 /* test whether ftruncte() can extend a file */ 00002 00003 #if defined(HAVE_UNISTD_H) 00004 #include <unistd.h> 00005 #endif 00006 00007 #include <sys/types.h> 00008 #include <sys/stat.h> 00009 #include <fcntl.h> 00010 00011 #define DATA "conftest.trunc" 00012 #define LEN 7663 00013 00014 main() 00015 { 00016 int *buf; 00017 int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666); 00018 00019 ftruncate(fd, LEN); 00020 00021 unlink(DATA); 00022 00023 if (lseek(fd, 0, SEEK_END) == LEN) { 00024 exit(0); 00025 } 00026 exit(1); 00027 }