[ucarp/el6] init fix for octal.
Jon Ciesla
limb at fedoraproject.org
Tue Dec 11 15:09:23 UTC 2012
commit 9ddc1b70e9722f549740ee4eced8f009cbaf2b5a
Author: Jon Ciesla <limburgher at gmail.com>
Date: Tue Dec 11 09:04:43 2012 -0600
init fix for octal.
ucarp.init | 15 ++++++++++++++-
ucarp.spec | 5 ++++-
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/ucarp.init b/ucarp.init
index 0231a01..dfcf3e9 100755
--- a/ucarp.init
+++ b/ucarp.init
@@ -65,7 +65,20 @@ start() {
[ "${MASTER:-NULL}" == "${SOURCE_ADDRESS}" ] || OPTIONS="${OPTIONS} --advskew=1"
# Set the ID from the config file if it's defined, otherwise guess from the filename
- [ ${ID} ] || ID=`echo ${FILE} | sed 's/^vip-\(.*\).conf/\1/'`
+ if [[ -z "$ID" ]]; then
+ ID="${FILE#vip-}"; ID="${ID%.conf}"
+ IDnozero="${ID#0}"; IDnozero="${IDnozero#0}"
+ if [[ "$ID" != "$IDnozero" ]]; then
+ if [[ "${ID}" != "${ID/8}" || "${ID}" != "${ID/9}" ]]; then
+ # Has leading zeroes, is not a valid octal number.
+ # Remove leading zeroes, interpret it as decimal.
+ ID="$IDnozero"
+ else
+ # Has leading zeroes, will be interpreted as octal.
+ ${LOGGER} "$FILE uses VIP ID" $(($ID)) "(octal $ID). To use $ID, add the line 'ID=$IDnozero' to $FILE or rename it to vip-$IDnozero.conf"
+ fi
+ fi
+ fi
if [ ${ID} -lt 1 -o ${ID} -gt 255 ]; then
${LOGGER} "ID out of range (1-255) for ${FILE}, skipped VIP ID ${ID}"
diff --git a/ucarp.spec b/ucarp.spec
index 6fc27ee..c7d27e1 100644
--- a/ucarp.spec
+++ b/ucarp.spec
@@ -1,7 +1,7 @@
Summary: Common Address Redundancy Protocol (CARP) for Unix
Name: ucarp
Version: 1.5.2
-Release: 5%{?dist}
+Release: 6%{?dist}
# See the COPYING file which details everything
License: MIT and BSD
Group: System Environment/Daemons
@@ -100,6 +100,9 @@ fi
%{_sbindir}/ucarp
%changelog
+* Tue Dec 11 2012 Jon Ciesla <limburgher at gmail.com> - 1.5.2-6
+- init fix from Alexander Bostrom, BZ 809421.
+
* Tue Nov 13 2012 Jon Ciesla <limburgher at gmail.com> - 1.5.2-5
- Additional init fix.
More information about the scm-commits
mailing list