Change fallocate() to posix_fallocate() 84/221684/1 accepted/tizen/unified/20200108.131641 submit/tizen/20200107.053941
authorSangwan Kwon <sangwan.kwon@samsung.com>
Tue, 7 Jan 2020 04:01:07 +0000 (13:01 +0900)
committerSangwan Kwon <sangwan.kwon@samsung.com>
Tue, 7 Jan 2020 04:09:46 +0000 (13:09 +0900)
For the portable, POSIX.1-specified method of ensuring that
space is allocated for a file.

The main reason of this patch is to support GCC 9.2.
ref) https://review.tizen.org/gerrit/gitweb?p=platform%2Fcore%2Fsecurity%2Fode.git;a=shortlog;h=refs%2Fheads%2Fsandbox%2Fakazmin%2Ftizen_6.0_build

Change-Id: I8baf4feb5fce364f6ecf0ba08c46b90ac7ca1457
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
server/file-sink.cpp

index 091b69b..e1fc324 100644 (file)
@@ -74,7 +74,7 @@ void FileLogSink::resize()
        if (blkcnt <= MAX_LOG_LEN)
                return;
 
-       ret = ::fallocate(fd, FALLOC_FL_COLLAPSE_RANGE, 0, blksize*(blkcnt-MAX_LOG_LEN));
+       ret = ::posix_fallocate(fd, 0, blksize*(blkcnt-MAX_LOG_LEN));
        if (ret < 0)
                std::cerr << "Failed to collapse the log file : " << errno << std::endl;
 }