ref: dea69649e49ba7a208c62ba0d4dc3bfb1d341353
dir: /libnpe/ftruncate.c/
#include <npe.h>
#include <errno.h>
int
ftruncate(int fd, off_t length)
{
Dir d;
if(length < 0){
errno = EINVAL;
return -1;
}
nulldir(&d);
d.length = length;
if(dirfwstat(fd, &d) < 0){
errno = ENOENT;
return -1;
}
return 0;
}