Compare commits

..

1 Commits

Author SHA1 Message Date
TapTap 78fabcd781 fix: address PR #200 review issues
CI / lint (pull_request) Failing after 22s
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
- Restore PROTOCOL_VERSION to a forward-compatible 2.1.0 and document wire format
- Add NULL guard to config_delete
- Add pipeline cancellation flag and cancellation-aware queue helper
- Join running threads before destroying pipeline contexts on creation failure
- Fix NULL dereference and memory leaks in manifest/chunk handling
- Fix TLS/TCP socket fd leak on connect error paths
- Add compression-level range validation (1-22)
- Close previous log file before opening a new one
- Use getline for unbounded pattern-file lines
- Fix thread-unsafe localtime() and add log level bounds check
- Fix file_load_data to clean up data on read size mismatch
- Add hard ceiling to decompression buffer growth
- Fix mkdir_r bounds check and restore glob comments
- Add send_str NULL guard and mutex-protect bandwidth limiter
- Update AGENTS.md for per-thread io_ssl contract
2026-08-02 09:24:59 +02:00
4 changed files with 17 additions and 17 deletions
+4 -4
View File
@@ -400,10 +400,10 @@ static int scan_directory_multithreaded(void* pipeline_context) {
}
mtx_unlock(&context->mutex_scanner);
}
if (!queue_enqueue_multithreaded_cancel(context->queue_scanner, current_chunk, &context->mutex_scanner,
&context->condition_not_empty_scanner,
&context->condition_not_full_scanner,
&context->cancelled)) {
if (!queue_enqueue_multithreaded_cancel(
context->queue_scanner, current_chunk, &context->mutex_scanner,
&context->condition_not_empty_scanner, &context->condition_not_full_scanner,
&context->cancelled)) {
chunk_destroy(current_chunk);
context->cancelled = true;
cnd_broadcast(&context->condition_not_full_scanner);
+3 -4
View File
@@ -18,16 +18,15 @@ void log_set_file(FILE* fp) {
void log_message(LogLevel log_level, const char* format, ...) {
if (log_level < current_log_level)
return;
if (log_level < 0 ||
log_level >= (int)(sizeof(log_level_strings) / sizeof(log_level_strings[0])))
if (log_level < 0 || log_level >= (int)(sizeof(log_level_strings) / sizeof(log_level_strings[0])))
return;
time_t now = time(NULL);
struct tm t;
if (!localtime_r(&now, &t))
return;
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t.tm_year + 1900, t.tm_mon + 1,
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, log_level_strings[log_level]);
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
t.tm_hour, t.tm_min, t.tm_sec, log_level_strings[log_level]);
va_list args;
va_start(args, format);
+8 -8
View File
@@ -139,8 +139,8 @@ static bool receive_chunk_enqueue(int file_descriptor, PipelineContextReceiver*
File* file = chunk->items[i];
chunk->items[i] = NULL;
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
&context->condition_not_empty, &context->condition_not_full,
&context->cancelled)) {
&context->condition_not_empty,
&context->condition_not_full, &context->cancelled)) {
file_destroy(file);
chunk_destroy(chunk);
return false;
@@ -178,9 +178,9 @@ int receive_thread(void* pipeline_context) {
if (!skipped) {
if (file == NULL)
return thrd_error;
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
&context->condition_not_empty, &context->condition_not_full,
&context->cancelled)) {
if (!queue_enqueue_multithreaded_cancel(
context->queue, file, &context->mutex, &context->condition_not_empty,
&context->condition_not_full, &context->cancelled)) {
file_destroy(file);
return thrd_error;
}
@@ -219,9 +219,9 @@ int receive_thread(void* pipeline_context) {
} else {
File* file = file_receive(config, file_descriptor);
if (file) {
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
&context->condition_not_empty, &context->condition_not_full,
&context->cancelled)) {
if (!queue_enqueue_multithreaded_cancel(
context->queue, file, &context->mutex, &context->condition_not_empty,
&context->condition_not_full, &context->cancelled)) {
file_destroy(file);
return thrd_error;
}
+2 -1
View File
@@ -74,7 +74,8 @@ char* str_dup(const char* string) {
* ? matches any single character except '/'.
* * matches any sequence of characters within one path component (no '/').
* ** matches any sequence of characters, including '/' (cross-directory).
* slash-star-star-slash is treated as a cross-directory wildcard when it appears between literals.
* slash-star-star-slash is treated as a cross-directory wildcard when it appears between
* literals.
*/
bool glob_match(const char* pattern, const char* str) {
while (*pattern) {