Rotation logic was not working properly because
std::remove() with file which is not exists will return negative integer.
Change-Id: I2f1b1b792e306024af4545e4586fb5069a0330d9
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
bool FileLogBackend::Rotate() {
for (int i = max_rotation_; i > 0; i--) {
std::string old_log = file_name_ + "." + std::to_string(i);
+
+ struct stat tmp_buffer;
+ if (stat(old_log.c_str(), &tmp_buffer) != 0)
+ continue;
+
// the oldest log will be removed
if (i == max_rotation_) {
if (std::remove(old_log.c_str()) != 0)