Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
	if (argc == 2) {
		const char *path = argv[1];
		unlink_old_files(path);
		/* If stdout isn't a terminal, supress progress. */
		return fill_fs(path, isatty(STDOUT_FILENO));
	}

	print_header(stderr, "write");
	fprintf(stderr, "Usage: f3write <PATH>\n");
	return 1;
}
Ejemplo n.º 2
0
static void mdbox_map_cleanup(struct mdbox_map *map)
{
	unsigned int interval =
		MAP_STORAGE(map)->set->mail_temp_scan_interval;
	struct stat st;

	if (stat(map->path, &st) < 0)
		return;

	/* check once in a while if there are temp files to clean up */
	if (interval == 0) {
		/* disabled */
	} else if (st.st_atime > st.st_ctime + DBOX_TMP_DELETE_SECS) {
		/* there haven't been any changes to this directory since we
		   last checked it. */
	} else if (st.st_atime < ioloop_time - (time_t)interval) {
		/* time to scan */
		(void)unlink_old_files(map->path, DBOX_TEMP_FILE_PREFIX,
				       ioloop_time - DBOX_TMP_DELETE_SECS);
	}
}