~adigitoleo/axe

c3603d309cb774be5ec960ef57405fc0a04d46b3 — adigitoleo 5 months ago f2378d8 v0.2.3
fix: Fix incorrect handling of missing old logfiles
1 files changed, 8 insertions(+), 9 deletions(-)

M axe.sh
M axe.sh => axe.sh +8 -9
@@ 99,21 99,20 @@ while [ $# -gt 0 ]; do
        { warn "directory /var/log/socklog/$1 does not exist or is inacessible"; shift; continue; }
    # Add the old log files, ending in .s or .u, to the list if they are readable.
    for LOGFILE in /var/log/socklog/"$1"/*.[us]; do
        if test -r "$LOGFILE"; then
            LOGS="${LOGS} ${LOGFILE}"
        else
            warn "unable to read log file '$LOGFILE' due to insufficient permissions"
            shift
            continue
        fi
        case "$LOGFILE" in
            *_[us] ) break ;; # In POSIX sh, failed globs just return the pattern.
            * ) if test -r "$LOGFILE"; then
                    LOGS="${LOGS} ${LOGFILE}"
                else
                    warn "unable to read log file '$LOGFILE' due to insufficient permissions"
                fi ;;
        esac
    done
    # Check for current log file and add to the list if readable.
    if test -r /var/log/socklog/"$1"/current; then
        LOGS="${LOGS} /var/log/socklog/$1/current"
    else
        warn "unable to read current log for '$1' due to insufficient permissions"
        shift
        continue
    fi
    shift  # Advance to next log directory.
done