if (fstatfs(cur_fd, &statfs) && cur_fd!=START_VALUE) {
my_log(LOG_ERR, "PANIC! Can't stat disk to calculate free blocks");
}
else {
if (fstatfs(cur_fd, &statfs) && cur_fd!=START_VALUE) {
my_log(LOG_ERR, "PANIC! Can't stat disk to calculate free blocks");
}
else {
switch(cur_epoch) {
case 0: /* Uh oh. Our first file filled up all of the free space. Just bail out. */
my_log(LOG_ERR, "The first epoch filled up all the free space on disk. Bailing out.");
switch(cur_epoch) {
case 0: /* Uh oh. Our first file filled up all of the free space. Just bail out. */
my_log(LOG_ERR, "The first epoch filled up all the free space on disk. Bailing out.");
char nextname[MAX_PATH_LEN];
int write_fd;
prev_uptime = cur_uptime;
cur_epoch = (cur_epoch + 1) % log_epochs;
char nextname[MAX_PATH_LEN];
int write_fd;
prev_uptime = cur_uptime;
cur_epoch = (cur_epoch + 1) % log_epochs;
snprintf(nextname,MAX_PATH_LEN,"%s.%d",fname,cur_epoch);
if ((write_fd = open(nextname, O_WRONLY|O_CREAT|O_TRUNC)) < 0) {
my_log(LOG_ERR, "open(): %s (%s)\n", nextname, strerror(errno));
snprintf(nextname,MAX_PATH_LEN,"%s.%d",fname,cur_epoch);
if ((write_fd = open(nextname, O_WRONLY|O_CREAT|O_TRUNC)) < 0) {
my_log(LOG_ERR, "open(): %s (%s)\n", nextname, strerror(errno));