libnetwork/iptables: don't use err.Error() if not needed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-05 15:20:13 +02:00
parent 9717734d1c
commit 829374337f
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -581,7 +581,7 @@ func (iptable IPTable) AddReturnRule(chain string) error {
err := iptable.RawCombinedOutput("-A", chain, "-j", "RETURN")
if err != nil {
return fmt.Errorf("unable to add return rule in %s chain: %s", chain, err.Error())
return fmt.Errorf("unable to add return rule in %s chain: %v", chain, err)
}
return nil
@ -592,13 +592,13 @@ func (iptable IPTable) EnsureJumpRule(fromChain, toChain string) error {
if iptable.Exists(Filter, fromChain, "-j", toChain) {
err := iptable.RawCombinedOutput("-D", fromChain, "-j", toChain)
if err != nil {
return fmt.Errorf("unable to remove jump to %s rule in %s chain: %s", toChain, fromChain, err.Error())
return fmt.Errorf("unable to remove jump to %s rule in %s chain: %v", toChain, fromChain, err)
}
}
err := iptable.RawCombinedOutput("-I", fromChain, "-j", toChain)
if err != nil {
return fmt.Errorf("unable to insert jump to %s rule in %s chain: %s", toChain, fromChain, err.Error())
return fmt.Errorf("unable to insert jump to %s rule in %s chain: %v", toChain, fromChain, err)
}
return nil