Skip to content

Commit

Permalink
Merge pull request #31 from fwang2/master
Browse files Browse the repository at this point in the history
do away with ftruncate(), fix fallocate() signature, #23
  • Loading branch information
fwang2 authored Aug 29, 2018
2 parents 7513015 + fb10428 commit b037cbb
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 b037cbb

Please sign in to comment.