qrexec-lib: add support for verbose mode (echo just processed file)

This commit is contained in:
Marek Marczykowski-Górecki 2013-11-13 10:35:47 +01:00
parent 761305bc8b
commit 21612bfadf
2 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,7 @@ enum {
int copy_file(int outfd, int infd, long long size, unsigned long *crc32);
char *copy_file_status_to_str(int status);
void set_size_limit(long long new_bytes_limit, long long new_files_limit);
void set_verbose(int value);
int write_all(int fd, void *buf, int size);
int read_all(int fd, void *buf, int size);
int copy_fd_all(int fdout, int fdin);

View File

@ -16,6 +16,7 @@ long long bytes_limit = 0;
long long files_limit = 0;
long long total_bytes = 0;
long long total_files = 0;
int verbose = 0;
void set_size_limit(long long new_bytes_limit, long long new_files_limit)
{
@ -23,6 +24,11 @@ void set_size_limit(long long new_bytes_limit, long long new_files_limit)
files_limit = new_files_limit;
}
void set_verbose(int value)
{
verbose = value;
}
unsigned long crc32_sum = 0;
int read_all_with_crc(int fd, void *buf, int size) {
int ret;
@ -143,6 +149,8 @@ void process_one_file(struct file_header *untrusted_hdr)
process_one_file_dir(untrusted_hdr, untrusted_namebuf);
else
do_exit(EINVAL, untrusted_namebuf);
if (verbose && !S_ISDIR(untrusted_hdr->mode))
fprintf(stderr, "%s\n", untrusted_namebuf);
}
int do_unpack()