[OpenWrt-Devel] [PATCH] [base-files] remove useless explicit set of function returncode
Bastian Bittorf
bittorf at bluebottle.com
Wed Aug 20 14:22:21 EDT 2014
[base-files] remove useless explicit set of function returncode
somebody started to set a function returncode in the validation
stuff and everybody copies it, e.g.
myfunction()
{
fire_command
return $?
}
a function automatically returns with the last returncode,
so we can safely remove the command 'return $?'. reference:
http://tldp.org/LDP/abs/html/exit-status.html
"The last command executed in the function or script determines the exit status."
Signed-off-by: Bastian Bittorf <bittorf at bluebottle.com>
---
package/base-files/files/etc/init.d/system | 2 --
package/network/config/firewall/files/firewall.init | 4 ----
package/network/config/netifd/files/etc/init.d/network | 14 --------------
package/network/services/dropbear/files/dropbear.init | 1 -
package/network/services/relayd/files/relay.init | 2 --
package/system/ubox/files/log.init | 2 --
package/utils/busybox/files/sysntpd | 1 -
8 files changed, 1 insertion(+), 26 deletions(-)
create mode 160000 kalua
@@ -0,0 +1 @@
+Subproject commit 2fbbcb4c21178e8b4991727994d2036e768dd3eb
diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system
index 24a9fde..6388d62 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -12,8 +12,6 @@ validate_system_section()
'buffersize:uinteger' \
'timezone:string:UTC' \
'zonename:string'
-
- return $?
}
system_config() {
diff --git a/package/network/config/firewall/files/firewall.init b/package/network/config/firewall/files/firewall.init
index 1147b83..9664e39 100755
--- a/package/network/config/firewall/files/firewall.init
+++ b/package/network/config/firewall/files/firewall.init
@@ -15,8 +15,6 @@ validate_firewall_redirect()
'dest_ip:cidr' \
'dest_port:or(port, portrange)' \
'target:or("SNAT", "DNAT")'
-
- return $?
}
validate_firewall_rule()
@@ -28,8 +26,6 @@ validate_firewall_rule()
'src_port:or(port, portrange)' \
'dest_port:or(port, portrange)' \
'target:string'
-
- return $?
}
service_triggers() {
diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network
index 8a7427b..1d8a5b3 100755
--- a/package/network/config/netifd/files/etc/init.d/network
+++ b/package/network/config/netifd/files/etc/init.d/network
@@ -50,8 +50,6 @@ validate_atm_bridge_section()
'atmdev:uinteger:0' \
'encaps:or("llc", "vc"):llc' \
'payload:or("bridged", "routed"):bridged'
-
- return $?
}
validate_route_section()
@@ -64,8 +62,6 @@ validate_route_section()
'metric:uinteger' \
'mtu:uinteger' \
'table:or(range(0,65535),string)'
-
- return $?
}
validate_route6_section()
@@ -77,8 +73,6 @@ validate_route6_section()
'metric:uinteger' \
'mtu:uinteger' \
'table:or(range(0,65535),string)'
-
- return $?
}
validate_rule_section()
@@ -94,8 +88,6 @@ validate_rule_section()
'lookup:or(range(0,65535),string)' \
'goto:range(0,65535)' \
'action:or("prohibit", "unreachable", "blackhole", "throw")'
-
- return $?
}
validate_rule6_section()
@@ -111,8 +103,6 @@ validate_rule6_section()
'lookup:or(range(0,65535),string)' \
'goto:range(0,65535)' \
'action:or("prohibit", "unreachable", "blackhole", "throw")'
-
- return $?
}
validate_switch_section()
@@ -122,8 +112,6 @@ validate_switch_section()
'enable:bool' \
'enable_vlan:bool' \
'reset:bool'
-
- return $?
}
validate_switch_vlan()
@@ -132,8 +120,6 @@ validate_switch_vlan()
'device:string' \
'vlan:uinteger' \
'ports:list(ports)'
-
- return $?
}
service_triggers()
diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index 5206426..c6f3d9b 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -47,7 +47,6 @@ validate_section_dropbear()
'Port:list(port):22' \
'SSHKeepAlive:uinteger:300' \
'IdleTimeout:uinteger:0'
- return $?
}
dropbear_instance()
diff --git a/package/network/services/relayd/files/relay.init b/package/network/services/relayd/files/relay.init
index e193312..e38143f 100644
--- a/package/network/services/relayd/files/relay.init
+++ b/package/network/services/relayd/files/relay.init
@@ -15,8 +15,6 @@ validate_proto_relayd()
'table:range(0, 65535):16800' \
'forward_bcast:bool:1' \
'forward_dhcp:bool:1'
-
- return $?
}
resolve_ifname() {
diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init
index be38297..3e06fa5 100644
--- a/package/system/ubox/files/log.init
+++ b/package/system/ubox/files/log.init
@@ -19,7 +19,6 @@ validate_log_section()
'log_port:port:514' \
'log_proto:or("tcp", "udp"):udp' \
'log_prefix:string'
- return $?
}
validate_log_daemon()
@@ -27,7 +26,6 @@ validate_log_daemon()
uci_validate_section system system "${1}" \
'log_size:uinteger:0' \
'log_buffer_size:uinteger:0'
- return $?
}
start_service_daemon()
diff --git a/package/utils/busybox/files/sysntpd b/package/utils/busybox/files/sysntpd
index 1878c3f..417addf 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -9,7 +9,6 @@ PROG=/usr/sbin/ntpd
validate_ntp_section() {
uci_validate_section system timeserver "${1}" \
'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0'
- return $?
}
start_service() {
--
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list