bug: file_send_sendfile accepts compression_level parameter but ignores it #41

Closed
opened 2026-07-20 14:58:49 +02:00 by TapTap · 0 comments
Owner

In src/shared/file.c:436-468, the file_send_sendfile function accepts a compression_level parameter but explicitly ignores it:

bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int compression_level,
                        bool send_path) {
  (void)compression_level;  // silently ignored

This means that using --sendfile with compression silently disables compression. Worse, the CLI validation at client_cli.c:242 checks for this combination:

if (config->use_sendfile && (config->use_chunk_serialization || config->use_compression)) {
    fprintf(stderr, "Error: -f/--sendfile cannot be combined with -c (compression)\n");

But in the multithreaded path (client_send.c:145-161), the condition only checks !config->use_compression to decide the sendfile path, which is correct. However, the function signature is misleading since it advertises a compression parameter it cannot honor.

Fix: Either remove the parameter from the function signature, or implement compression support in the sendfile path using a temporary pipe.

Severity: low

In src/shared/file.c:436-468, the file_send_sendfile function accepts a compression_level parameter but explicitly ignores it: ```c bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int compression_level, bool send_path) { (void)compression_level; // silently ignored ``` This means that using --sendfile with compression silently disables compression. Worse, the CLI validation at client_cli.c:242 checks for this combination: ```c if (config->use_sendfile && (config->use_chunk_serialization || config->use_compression)) { fprintf(stderr, "Error: -f/--sendfile cannot be combined with -c (compression)\n"); ``` But in the multithreaded path (client_send.c:145-161), the condition only checks `!config->use_compression` to decide the sendfile path, which is correct. However, the function signature is misleading since it advertises a compression parameter it cannot honor. Fix: Either remove the parameter from the function signature, or implement compression support in the sendfile path using a temporary pipe. Severity: low
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#41