X Strike Force XFree86 SVN commit: rev 707 - trunk/debian
Author: branden
Date: 2003-10-23 02:54:25 -0500 (Thu, 23 Oct 2003)
New Revision: 707
Modified:
trunk/debian/xserver-xfree86.config.in
Log:
Improve implementation of priority_ceil():
+ Regard null, unset, or bogusly-valued PRIORITY_CEILING shell variable as
a ceiling of "critical", not "low".
+ Use a locally-scoped variable for priority ceiling assignment and
comparison operations after PRIORITY_CEILING has been evaluated, so that
we don't change the value of PRIORITY_CEILING in the global scope.
- debian/xserver-xfree86.config.in
Modified: trunk/debian/xserver-xfree86.config.in
===================================================================
--- trunk/debian/xserver-xfree86.config.in 2003-10-23 07:49:15 UTC (rev 706)
+++ trunk/debian/xserver-xfree86.config.in 2003-10-23 07:54:25 UTC (rev 707)
@@ -283,7 +283,7 @@
# Better just to go the simple and stupid route. Yes, I know this is not
# very efficient.
- local requested_priority
+ local priority_ceiling requested_priority
# Validate arguments.
if [ $# -ne 1 ]; then
@@ -294,38 +294,47 @@
requested_priority="$1"
fi
+ # If PRIORITY_CEILING is null or unset, it's same as not having one at all;
+ # the sky's the limit. We use a locally scoped priority_ceiling variable
+ # because we don't want to affect the value of the global one.
+ if [ -n "$PRIORITY_CEILING" ]; then
+ priority_ceiling="$PRIORITY_CEILING"
+ else
+ priority_ceiling=critical
+ fi
+
# Ensure the value of PRIORITY_CEILING is reasonable.
- if [ "$PRIORITY_CEILING" != "critical" \
- -a "$PRIORITY_CEILING" != "high" \
- -a "$PRIORITY_CEILING" != "medium" \
- -a "$PRIORITY_CEILING" != "low" ]; then
- debug_echo "priority_ceil() called with empty or bogus value of" \
- "\$PRIORITY_CEILING \"$PRIORITY_CEILING\"; setting to \"low\""
- PRIORITY_CEILING=low
+ if [ "$priority_ceiling" != "critical" \
+ -a "$priority_ceiling" != "high" \
+ -a "$priority_ceiling" != "medium" \
+ -a "$priority_ceiling" != "low" ]; then
+ debug_echo "priority_ceil() called with bogus value of \$PRIORITY_CEILING" \
+ "\"$PRIORITY_CEILING\"; treating as \"critical\""
+ priority_ceiling=critical
fi
case "$requested_priority" in
critical)
# This is the highest priority, so there is nowhere to go but down.
- echo "$PRIORITY_CEILING"
+ echo "$priority_ceiling"
;;
high)
- case "$PRIORITY_CEILING" in
+ case "$priority_ceiling" in
critical)
echo "$requested_priority"
;;
high|medium|low)
- echo "$PRIORITY_CEILING"
+ echo "$priority_ceiling"
;;
esac
;;
medium)
- case "$PRIORITY_CEILING" in
+ case "$priority_ceiling" in
critical|high)
echo "$requested_priority"
;;
medium|low)
- echo "$PRIORITY_CEILING"
+ echo "$priority_ceiling"
;;
esac
;;
Reply to: