void check_log_file(t_client *client) { struct stat st; ssize_t size; stat(client->server->conf->log_file, &st); size = st.st_size; if (size > atoi(client->server->conf->log_max_size)) move_log_file(client); }
static gboolean log_file_backup_maybe (const char *logfile) { struct stat statbuf; if (stat (logfile, &statbuf) != 0) { if (errno == ENOENT) return TRUE; /* it did not exist yet, no problem */ else { g_warning ("failed to stat(2) %s: %s", logfile, strerror(errno)); return FALSE; } } /* log file is still below the max size? */ if (statbuf.st_size <= MU_MAX_LOG_FILE_SIZE) return TRUE; /* log file is too big!; we move it to <logfile>.old, overwriting */ return move_log_file (logfile); }