Skip to content

Commit

Permalink
do away with ftruncate(), fix fallocate() signature, olcf#23
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang2 committed Aug 29, 2018
1 parent 7513015 commit fb10428
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions lib/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,7 @@ void *posix_write(void *fdes, lcio_job_t *job, off_t flag) {
*rv = 0;

if(job->ftrunc){
if(flag == 0) {
#ifdef HAVE_POSIX_FALLOCATE
*rv = posix_fallocate(*(int*) fdes, job->blk_sz);
#else
*rv = ftruncate(*(int*) fdes, job->blk_sz);
#endif
if(*rv > -1) *rv = (ssize_t) job->blk_sz;
}
else {
#ifdef HAVE_POSIX_FALLOCATE
*rv = posix_fallocate(*(int*)fdes, flag);
#else
*rv = ftruncate(*(int*)fdes, flag);
#endif
if(*rv > -1) *rv = (ssize_t) flag;
}
*rv = posix_fallocate(*(int*)fdes, 0, flag);
return rv;
}

Expand Down

0 comments on commit fb10428

Please sign in to comment.