In src/client/scanner.c, the open_next_directory() function returns 0 for two very different conditions:
Lines 58-77:
staticintopen_next_directory(DirectoryScanner*scanner){...if(queue_is_empty(scanner->directories))return0;// CASE 1: No more directories to scan
scanner->current_path=(char*)queue_dequeue(scanner->directories);scanner->current_dir=opendir(scanner->current_path);if(scanner->current_dir==NULL){perror("Could not open directory");free(scanner->current_path);scanner->current_path=NULL;return0;// CASE 2: opendir failed
}return1;}
When opendir() fails (e.g., permission denied on a subdirectory), the code silently drops the directory from the queue and continues. This means:
Files inside unreadable directories are silently skipped
No error is propagated to the user beyond the perror() call
The scanner will not retry or report the failure
Suggested Fix: Return distinct error codes (-1 for errors) and log warnings. Consider collecting and reporting inaccessible directories.
Severity: medium
In `src/client/scanner.c`, the `open_next_directory()` function returns `0` for two very different conditions:
**Lines 58-77:**
```c
static int open_next_directory(DirectoryScanner* scanner) {
...
if (queue_is_empty(scanner->directories))
return 0; // CASE 1: No more directories to scan
scanner->current_path = (char*)queue_dequeue(scanner->directories);
scanner->current_dir = opendir(scanner->current_path);
if (scanner->current_dir == NULL) {
perror("Could not open directory");
free(scanner->current_path);
scanner->current_path = NULL;
return 0; // CASE 2: opendir failed
}
return 1;
}
```
When `opendir()` fails (e.g., permission denied on a subdirectory), the code silently drops the directory from the queue and continues. This means:
- Files inside unreadable directories are silently skipped
- No error is propagated to the user beyond the `perror()` call
- The scanner will not retry or report the failure
**Suggested Fix:** Return distinct error codes (-1 for errors) and log warnings. Consider collecting and reporting inaccessible directories.
**Severity:** medium
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In
src/client/scanner.c, theopen_next_directory()function returns0for two very different conditions:Lines 58-77:
When
opendir()fails (e.g., permission denied on a subdirectory), the code silently drops the directory from the queue and continues. This means:perror()callSuggested Fix: Return distinct error codes (-1 for errors) and log warnings. Consider collecting and reporting inaccessible directories.
Severity: medium