Commit | Line | Data |
7b2b351e |
1 | /* Beginning of modification history */ |
2 | /* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */ |
3 | /* End of modification history */ |
4 | |
5 | /* VOS doesn't supply a truncate function, so we build one up |
6 | from the available POSIX functions. */ |
7 | |
8 | #include <fcntl.h> |
9 | #include <sys/types.h> |
10 | #include <unistd.h> |
11 | |
12 | int |
13 | truncate(const char *path, off_t len) |
14 | { |
15 | int fd = open(path,O_WRONLY); |
16 | int code = -1; |
17 | if (fd >= 0) { |
18 | code = ftruncate(fd,len); |
19 | close(fd); |
20 | } |
21 | return code; |
22 | } |