svn commit: r351192 - head/usr.sbin/periodic
Alan Somers
asomers at FreeBSD.org
Sun Aug 18 17:12:07 UTC 2019
Author: asomers
Date: Sun Aug 18 17:12:06 2019
New Revision: 351192
URL: https://svnweb.freebsd.org/changeset/base/351192
Log:
periodic: fix anticongestion for scripts run after security
Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic. The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation. The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.
Fix this bug by delaying cleanup until the end of the original invocation.
PR: 236564
Submitted by: Yasuhiro KIMURA <yasu at utahime.org>
Reviewed by: imp
MFC after: 1 month
Modified:
head/usr.sbin/periodic/periodic.sh
Modified: head/usr.sbin/periodic/periodic.sh
==============================================================================
--- head/usr.sbin/periodic/periodic.sh Sun Aug 18 16:04:01 2019 (r351191)
+++ head/usr.sbin/periodic/periodic.sh Sun Aug 18 17:12:06 2019 (r351192)
@@ -78,6 +78,11 @@ arg=$1
if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then
export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX`
+ remove_periodic_anticongestion_file=yes
+else
+ # We might be in a recursive invocation; let the top-level invocation
+ # remove the file.
+ remove_periodic_anticongestion_file=no
fi
if tty > /dev/null 2>&1; then
export PERIODIC_IS_INTERACTIVE=1
@@ -147,4 +152,6 @@ esac
} | output_pipe $arg "$context"
rm -f $tmp_output
-rm -f $PERIODIC_ANTICONGESTION_FILE
+if [ $remove_periodic_anticongestion_file = "yes" ] ; then
+ rm -f $PERIODIC_ANTICONGESTION_FILE
+fi
More information about the svn-src-head
mailing list