Skip to content

Commit fb10428

Browse files
committed
do away with ftruncate(), fix fallocate() signature, #23
1 parent 7513015 commit fb10428

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

lib/posix.c

+1-16
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,7 @@ void *posix_write(void *fdes, lcio_job_t *job, off_t flag) {
4848
*rv = 0;
4949

5050
if(job->ftrunc){
51-
if(flag == 0) {
52-
#ifdef HAVE_POSIX_FALLOCATE
53-
*rv = posix_fallocate(*(int*) fdes, job->blk_sz);
54-
#else
55-
*rv = ftruncate(*(int*) fdes, job->blk_sz);
56-
#endif
57-
if(*rv > -1) *rv = (ssize_t) job->blk_sz;
58-
}
59-
else {
60-
#ifdef HAVE_POSIX_FALLOCATE
61-
*rv = posix_fallocate(*(int*)fdes, flag);
62-
#else
63-
*rv = ftruncate(*(int*)fdes, flag);
64-
#endif
65-
if(*rv > -1) *rv = (ssize_t) flag;
66-
}
51+
*rv = posix_fallocate(*(int*)fdes, 0, flag);
6752
return rv;
6853
}
6954

0 commit comments

Comments
 (0)