- if (set_file_size)
- {
- off_t bytesallocated = 0;
- u_int32_t alloc_flags = PREALLOCATE | ALLOCATEFROMPEOF | ALLOCATEALL;
- error = VNOP_ALLOCATE(ref->vp, set_file_size, alloc_flags,
- &bytesallocated, 0 /*fst_offset*/,
- ref->ctx);
- // F_SETSIZE:
- if (!error) error = vnode_setsize(ref->vp, set_file_size, IO_NOZEROFILL, ref->ctx);
- kprintf("vnode_setsize(%d) %qd\n", error, set_file_size);
- ref->filelength = bytesallocated;
- }
+ if (set_file_size)
+ {
+ error = vnode_setsize(ref->vp, set_file_size,
+ IO_NOZEROFILL | IO_NOAUTH, ref->ctx);
+ if (error)
+ goto out;
+ ref->filelength = set_file_size;
+ }