mirror of
https://github.com/ovh/the-bastion.git
synced 2025-10-06 19:45:43 +08:00
fix: tocttou in ttyrec rotation script
This commit is contained in:
parent
361c6a37a2
commit
d04b15a19e
1 changed files with 2 additions and 1 deletions
|
@ -24,8 +24,9 @@ if [ "$1" = "--big-only" ]; then
|
||||||
done < <(lsof -a -n -c ttyrec 2>/dev/null -- /home/ 2>/dev/null)
|
done < <(lsof -a -n -c ttyrec 2>/dev/null -- /home/ 2>/dev/null)
|
||||||
if [ -n "$tokill" ]; then
|
if [ -n "$tokill" ]; then
|
||||||
_log "Rotating $nb big ttyrec files..."
|
_log "Rotating $nb big ttyrec files..."
|
||||||
|
# add || true to avoid script termination due to TOCTTOU and set -e
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
kill -USR1 $tokill
|
kill -USR1 $tokill || true
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_log "Rotating all ttyrec files..."
|
_log "Rotating all ttyrec files..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue