style: apply clang-format
CI / lint (pull_request) Failing after 2m18s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
CI / lint (pull_request) Failing after 2m18s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
This commit is contained in:
@@ -374,7 +374,8 @@ static int scan_directory_multithreaded(void* pipeline_context) {
|
|||||||
context->config->exclude_patterns, context->config->exclude_count,
|
context->config->exclude_patterns, context->config->exclude_count,
|
||||||
context->config->include_patterns, context->config->include_count, context->config->max_size,
|
context->config->include_patterns, context->config->include_count, context->config->max_size,
|
||||||
context->config->min_size, context->config->max_depth, 4, context->config->follow_symlinks,
|
context->config->min_size, context->config->max_depth, 4, context->config->follow_symlinks,
|
||||||
context->config->copy_links, context->config->safe_links, context->config->copy_unsafe_links, context->config->checksum);
|
context->config->copy_links, context->config->safe_links, context->config->copy_unsafe_links,
|
||||||
|
context->config->checksum);
|
||||||
|
|
||||||
Chunk* current_chunk;
|
Chunk* current_chunk;
|
||||||
while ((current_chunk = parallel_scanner_next(scanner)) != NULL) {
|
while ((current_chunk = parallel_scanner_next(scanner)) != NULL) {
|
||||||
@@ -575,8 +576,8 @@ int send_files(Config* config) {
|
|||||||
}
|
}
|
||||||
if (config->stats) {
|
if (config->stats) {
|
||||||
double rate = elapsed_total > 0 ? total_bytes / (1048576.0 * elapsed_total) : 0;
|
double rate = elapsed_total > 0 ? total_bytes / (1048576.0 * elapsed_total) : 0;
|
||||||
fprintf(stderr, "Stats: %d files, %.1f MB, %.1f MB/s\n", total_files,
|
fprintf(stderr, "Stats: %d files, %.1f MB, %.1f MB/s\n", total_files, total_bytes / 1048576.0,
|
||||||
total_bytes / 1048576.0, rate);
|
rate);
|
||||||
}
|
}
|
||||||
directory_scanner_destroy(scanner);
|
directory_scanner_destroy(scanner);
|
||||||
client_disconnect(client);
|
client_disconnect(client);
|
||||||
|
|||||||
@@ -355,8 +355,7 @@ ParallelScanner* parallel_scanner_create(char* root_directory, bool use_metadata
|
|||||||
bool is_symlink = S_ISLNK(lstats.st_mode);
|
bool is_symlink = S_ISLNK(lstats.st_mode);
|
||||||
|
|
||||||
// Skip symlinks unless the user explicitly enabled following/copying them.
|
// Skip symlinks unless the user explicitly enabled following/copying them.
|
||||||
if (is_symlink && !follow_symlinks && !copy_links && !safe_links &&
|
if (is_symlink && !follow_symlinks && !copy_links && !safe_links && !copy_unsafe_links) {
|
||||||
!copy_unsafe_links) {
|
|
||||||
free(cur_path);
|
free(cur_path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -162,8 +162,8 @@ Chunk* chunk_deserialize(Data* data, bool use_metadata) {
|
|||||||
|
|
||||||
// Reject individual file data larger than the maximum allowed size.
|
// Reject individual file data larger than the maximum allowed size.
|
||||||
if (file_data_size > MAX_FILE_DATA_SIZE) {
|
if (file_data_size > MAX_FILE_DATA_SIZE) {
|
||||||
log_message(LOG_LEVEL_ERROR, "File data size %zu exceeds maximum %llu",
|
log_message(LOG_LEVEL_ERROR, "File data size %zu exceeds maximum %llu", file_data_size,
|
||||||
file_data_size, (unsigned long long)MAX_FILE_DATA_SIZE);
|
(unsigned long long)MAX_FILE_DATA_SIZE);
|
||||||
array_list_delete(files);
|
array_list_delete(files);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -224,8 +224,8 @@ Chunk* receive_chunk_data(int fd, const Config* config) {
|
|||||||
|
|
||||||
// Reject chunks larger than the maximum allowed size to prevent OOM.
|
// Reject chunks larger than the maximum allowed size to prevent OOM.
|
||||||
if (data_to_process->size > MAX_CHUNK_SIZE) {
|
if (data_to_process->size > MAX_CHUNK_SIZE) {
|
||||||
log_message(LOG_LEVEL_ERROR, "Chunk size %zu exceeds maximum %llu",
|
log_message(LOG_LEVEL_ERROR, "Chunk size %zu exceeds maximum %llu", data_to_process->size,
|
||||||
data_to_process->size, (unsigned long long)MAX_CHUNK_SIZE);
|
(unsigned long long)MAX_CHUNK_SIZE);
|
||||||
data_destroy(data_to_process);
|
data_destroy(data_to_process);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -143,7 +143,8 @@ bool file_save_to_disk(const char* root_directory, File* file, const Config* con
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* resolved_root = NULL;
|
char* resolved_root = NULL;
|
||||||
const char* actual_root = (partial_dir && config && config->partial) ? partial_dir : root_directory;
|
const char* actual_root =
|
||||||
|
(partial_dir && config && config->partial) ? partial_dir : root_directory;
|
||||||
resolved_root = realpath(actual_root, NULL);
|
resolved_root = realpath(actual_root, NULL);
|
||||||
if (resolved_root == NULL) {
|
if (resolved_root == NULL) {
|
||||||
if (mkdir_r(actual_root)) {
|
if (mkdir_r(actual_root)) {
|
||||||
@@ -223,8 +224,7 @@ bool file_save_to_disk(const char* root_directory, File* file, const Config* con
|
|||||||
size_t root_len = strlen(resolved_root);
|
size_t root_len = strlen(resolved_root);
|
||||||
if (strncmp(resolved_dir, resolved_root, root_len) != 0 ||
|
if (strncmp(resolved_dir, resolved_root, root_len) != 0 ||
|
||||||
(resolved_dir[root_len] != '\0' && resolved_dir[root_len] != '/')) {
|
(resolved_dir[root_len] != '\0' && resolved_dir[root_len] != '/')) {
|
||||||
log_message(LOG_LEVEL_ERROR, "Path escape detected: %s is outside %s", disk_path,
|
log_message(LOG_LEVEL_ERROR, "Path escape detected: %s is outside %s", disk_path, actual_root);
|
||||||
actual_root);
|
|
||||||
free(resolved_dir);
|
free(resolved_dir);
|
||||||
free(resolved_root);
|
free(resolved_root);
|
||||||
free(disk_path);
|
free(disk_path);
|
||||||
@@ -518,8 +518,8 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool to_disk(const char* path, const void* data, unsigned long long data_size,
|
bool to_disk(const char* path, const void* data, unsigned long long data_size, bool inplace,
|
||||||
bool inplace, bool sparse) {
|
bool sparse) {
|
||||||
char* tmp_path = NULL;
|
char* tmp_path = NULL;
|
||||||
char* directory = NULL;
|
char* directory = NULL;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -34,8 +34,8 @@ bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int
|
|||||||
size_t file_content_to_buffer(File* file);
|
size_t file_content_to_buffer(File* file);
|
||||||
FileMetadata* file_metadata_create(const struct stat* stats);
|
FileMetadata* file_metadata_create(const struct stat* stats);
|
||||||
void file_metadata_destroy(void* metadata);
|
void file_metadata_destroy(void* metadata);
|
||||||
bool to_disk(const char* path, const void* data, unsigned long long data_size,
|
bool to_disk(const char* path, const void* data, unsigned long long data_size, bool inplace,
|
||||||
bool inplace, bool sparse);
|
bool sparse);
|
||||||
bool file_save_to_disk(const char* root_directory, File* file, const Config* config);
|
bool file_save_to_disk(const char* root_directory, File* file, const Config* config);
|
||||||
File* receive_incremental_check(int fd, const Config* config, bool* skipped);
|
File* receive_incremental_check(int fd, const Config* config, bool* skipped);
|
||||||
int receive_manifest(int fd, const Config* config, int* next_status);
|
int receive_manifest(int fd, const Config* config, int* next_status);
|
||||||
|
|||||||
Reference in New Issue
Block a user