libcryfs/test/fspp/fuse/truncate/testutils/FuseTruncateTest.cpp
2016-02-11 12:53:42 +01:00

19 lines
455 B
C++

#include "FuseTruncateTest.h"
void FuseTruncateTest::TruncateFile(const char *filename, off_t size) {
int error = TruncateFileReturnError(filename, size);
EXPECT_EQ(0, error);
}
int FuseTruncateTest::TruncateFileReturnError(const char *filename, off_t size) {
auto fs = TestFS();
auto realpath = fs->mountDir() / filename;
int retval = ::truncate(realpath.c_str(), size);
if (retval == 0) {
return 0;
} else {
return errno;
}
}