expose lock release error from iptables util

This commit is contained in:
Minhan Xia
2017-07-05 14:25:01 -07:00
parent 96d8ab725b
commit 8de419b19f
3 changed files with 17 additions and 5 deletions

View File

@@ -338,7 +338,7 @@ func (runner *runner) RestoreAll(data []byte, flush FlushFlag, counters RestoreC
}
type iptablesLocker interface {
Close()
Close() error
}
// restoreInternal is the shared part of Restore/RestoreAll
@@ -361,7 +361,11 @@ func (runner *runner) restoreInternal(args []string, data []byte, flush FlushFla
if err != nil {
return err
}
defer locker.Close()
defer func(locker iptablesLocker) {
if err := locker.Close(); err != nil {
glog.Errorf("Failed to close iptables locks: %v", err)
}
}(locker)
}
// run the command and return the output or an error including the output and error