]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Only write to /proc route flush files if they exist
authorMartin Schwenke <martin@meltin.net>
Wed, 24 Jun 2015 11:06:22 +0000 (21:06 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 1 Jul 2015 02:18:29 +0000 (04:18 +0200)
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>
ctdb/config/functions
ctdb/tests/eventscripts/etc-ctdb/rc.local

index ec695830713d610413b0a47bdb7f37110e9ef418..bcef4c78b0b8cce1b38414aeb23ca877132b2edd 100755 (executable)
@@ -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
 }
 
 ########################################################
index 0291e574589fe1e307c5a1526b333d76445c873e..0932ab4ad03330c13bd01610140cbd568e9e51fd 100755 (executable)
@@ -23,6 +23,7 @@ nice_service ()
 
 # Always succeeds
 set_proc () { : ; }
+set_proc_maybe () { : ; }
 
 get_proc ()
 {