libcryfs/test/fspp/fuse/truncate/testutils/FuseTruncateTest.cpp

19 lines
464 B
C++
Raw Normal View History

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