From d04b15a19e10051c4051286a79a9e1abb4418206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Thu, 14 Jan 2021 16:12:33 +0000 Subject: [PATCH] fix: tocttou in ttyrec rotation script --- bin/cron/osh-rotate-ttyrec.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cron/osh-rotate-ttyrec.sh b/bin/cron/osh-rotate-ttyrec.sh index cfd96fb..faa6a83 100755 --- a/bin/cron/osh-rotate-ttyrec.sh +++ b/bin/cron/osh-rotate-ttyrec.sh @@ -24,8 +24,9 @@ if [ "$1" = "--big-only" ]; then done < <(lsof -a -n -c ttyrec 2>/dev/null -- /home/ 2>/dev/null) if [ -n "$tokill" ]; then _log "Rotating $nb big ttyrec files..." + # add || true to avoid script termination due to TOCTTOU and set -e # shellcheck disable=SC2086 - kill -USR1 $tokill + kill -USR1 $tokill || true fi else _log "Rotating all ttyrec files..."