| 19 | |
| 20 | |
| 21 | static bool fileEndsWith(FILE* file, std::string str) { |
| 22 | // Seek to last `len` characters |
| 23 | size_t len = str.size(); |
| 24 | std::fseek(file, -long(len), SEEK_END); |
| 25 | char actual[len]; |
| 26 | if (std::fread(actual, 1, len, file) != len) |
| 27 | return false; |
| 28 | return std::string(actual, len) == str; |
| 29 | } |
| 30 | |
| 31 | static bool isTruncated() { |
| 32 | if (logPath.empty()) |