コード例 #1
0
ファイル: unpack.c プロジェクト: Galland/qubes-linux-utils
int do_unpack(void)
{
	struct file_header untrusted_hdr;
#ifdef HAVE_SYNCFS
	int cwd_fd;
	int saved_errno;
#endif

	total_bytes = total_files = 0;
	/* initialize checksum */
	crc32_sum = 0;
	while (read_all_with_crc(0, &untrusted_hdr, sizeof untrusted_hdr)) {
		/* check for end of transfer marker */
		if (untrusted_hdr.namelen == 0) {
			errno = 0;
			break;
		}
		total_files++;
		if (files_limit && total_files > files_limit)
			do_exit(EDQUOT, untrusted_namebuf);
		process_one_file(&untrusted_hdr);
	}

#ifdef HAVE_SYNCFS
	saved_errno = errno;
	cwd_fd = open(".", O_RDONLY);
	if (cwd_fd >= 0 && syncfs(cwd_fd) == 0 && close(cwd_fd) == 0)
		errno = saved_errno;
#endif

	send_status_and_crc(errno, untrusted_namebuf);
	return errno;
}
コード例 #2
0
ファイル: unpack.c プロジェクト: qubesuser/qubes-linux-utils
int do_unpack(void)
{
	struct file_header untrusted_hdr;
	total_bytes = total_files = 0;
	/* initialize checksum */
	crc32_sum = 0;
	while (read_all_with_crc(0, &untrusted_hdr, sizeof untrusted_hdr)) {
		/* check for end of transfer marker */
		if (untrusted_hdr.namelen == 0) {
			errno = 0;
			break;
		}
		total_files++;
		if (files_limit && total_files > files_limit)
			do_exit(EDQUOT, untrusted_namebuf);
		process_one_file(&untrusted_hdr);
	}
	send_status_and_crc(errno, untrusted_namebuf);
	return errno;
}
コード例 #3
0
ファイル: unpack.c プロジェクト: Galland/qubes-linux-utils
void do_exit(int code, const char *last_filename)
{
	close(0);
	send_status_and_crc(code, last_filename);
	exit(code);
}