Only close the rotating log once

This commit is contained in:
ckolivas 2014-06-18 10:06:03 +10:00
parent 2b9062b44e
commit c3ce5321b0

View File

@ -866,13 +866,11 @@ bool rotating_log(const char *path, const char *msg)
}
if (unlikely(flock(fd, LOCK_EX))) {
fclose(fp);
close(fd);
LOGERR("Failed to flock %s in rotating_log!", filename);
return false;
}
fprintf(fp, "%s\n", msg);
fclose(fp);
close(fd);
return true;
}