summaryrefslogtreecommitdiff
path: root/vos/vos.c
blob: c3566d4a8e4ed92dbdef0faed0cc9a52d5859bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Beginning of modification history */
/* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */
/* End of modification history */

/* VOS doesn't supply a truncate function, so we build one up
   from the available POSIX functions.  */

#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>

int
truncate(const char *path, off_t len)
{
 int fd = open(path,O_WRONLY);
 int code = -1;
 if (fd >= 0) {
   code = ftruncate(fd,len);
   close(fd); 
 }
 return code;
}