Merge branch 'master' into interface-checks

This commit is contained in:
Gabe Rosenhouse
2016-12-15 18:20:34 -08:00
committed by GitHub
2 changed files with 51 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import (
"net"
"os"
"path/filepath"
"strings"
"github.com/containernetworking/cni/plugins/ipam/host-local/backend"
)
@ -61,7 +62,7 @@ func (s *Store) Reserve(id string, ip net.IP) (bool, error) {
if err != nil {
return false, err
}
if _, err := f.WriteString(id); err != nil {
if _, err := f.WriteString(strings.TrimSpace(id)); err != nil {
f.Close()
os.Remove(f.Name())
return false, err
@ -104,7 +105,7 @@ func (s *Store) ReleaseByID(id string) error {
if err != nil {
return nil
}
if string(data) == id {
if strings.TrimSpace(string(data)) == strings.TrimSpace(id) {
if err := os.Remove(path); err != nil {
return nil
}