summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-06-24 21:06:22 +1000
committerAmitay Isaacs <amitay@samba.org>2015-07-01 04:18:29 +0200
commit0c609c95051ff8c1e8fd61acc6abc7e4b4c4441b (patch)
tree8639c4c198e37c186d1ee8e8a8db220549a85608 /ctdb
parenteb159f3ff530de8828631b04e17bf0990aed906e (diff)
downloadsamba-0c609c95051ff8c1e8fd61acc6abc7e4b4c4441b.tar.gz
ctdb-scripts: Only write to /proc route flush files if they exist
On IPv4-only or IPv6-only systems one of these files will not exist. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/functions11
-rwxr-xr-xctdb/tests/eventscripts/etc-ctdb/rc.local1
2 files changed, 10 insertions, 2 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions
index ec695830713..bcef4c78b0b 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -221,6 +221,13 @@ set_proc ()
echo "$2" >"/proc/$1"
}
+set_proc_maybe ()
+{
+ if [ -w "/proc/$1" ] ; then
+ set_proc "$1" "$2"
+ fi
+}
+
######################################################
# wrapper around getting file contents from /proc/ to allow
# this to be hooked for testing
@@ -977,8 +984,8 @@ drop_all_public_ips ()
flush_route_cache ()
{
- set_proc sys/net/ipv4/route/flush 1
- set_proc sys/net/ipv6/route/flush 1
+ set_proc_maybe sys/net/ipv4/route/flush 1
+ set_proc_maybe sys/net/ipv6/route/flush 1
}
########################################################
diff --git a/ctdb/tests/eventscripts/etc-ctdb/rc.local b/ctdb/tests/eventscripts/etc-ctdb/rc.local
index 0291e574589..0932ab4ad03 100755
--- a/ctdb/tests/eventscripts/etc-ctdb/rc.local
+++ b/ctdb/tests/eventscripts/etc-ctdb/rc.local
@@ -23,6 +23,7 @@ nice_service ()
# Always succeeds
set_proc () { : ; }
+set_proc_maybe () { : ; }
get_proc ()
{