1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 20:19:45 +00:00

Improve performance and process handling

This commit is contained in:
Tw93
2025-12-28 19:37:42 +08:00
parent e7546d762b
commit faac42cb62
4 changed files with 39 additions and 7 deletions

View File

@@ -185,13 +185,13 @@ safe_sudo_find_delete() {
local age_days="${3:-7}"
local type_filter="${4:-f}"
# Validate base directory
if [[ ! -d "$base_dir" ]]; then
log_error "Directory does not exist: $base_dir"
return 1
# Validate base directory (use sudo for permission-restricted dirs)
if ! sudo test -d "$base_dir" 2>/dev/null; then
debug_log "Directory does not exist (skipping): $base_dir"
return 0
fi
if [[ -L "$base_dir" ]]; then
if sudo test -L "$base_dir" 2>/dev/null; then
log_error "Refusing to search symlinked directory: $base_dir"
return 1
fi