mirror of
https://github.com/containers/podman.git
synced 2025-12-07 06:11:07 +08:00
vendor c/common
Update the recent events-log changes to fix the build error. [NO NEW TESTS NEEDED] since there's no functional change. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
28
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
28
vendor/github.com/containers/common/libnetwork/cni/cni_conversion.go
generated
vendored
@@ -11,7 +11,6 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
pkgutil "github.com/containers/common/pkg/util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func createNetworkFromCNIConfigList(conf *libcni.NetworkConfigList, confPath string) (*types.Network, error) {
|
||||
@@ -45,12 +45,11 @@ func createNetworkFromCNIConfigList(conf *libcni.NetworkConfigList, confPath str
|
||||
}
|
||||
}
|
||||
|
||||
f, err := os.Stat(confPath)
|
||||
t, err := fileTime(confPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
stat := f.Sys().(*syscall.Stat_t)
|
||||
network.Created = time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec))
|
||||
network.Created = t
|
||||
|
||||
firstPlugin := conf.Plugins[0]
|
||||
network.Driver = firstPlugin.Network.Type
|
||||
@@ -316,16 +315,15 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
|
||||
cniPathName := ""
|
||||
if writeToDisk {
|
||||
cniPathName = filepath.Join(n.cniConfigDir, network.Name+".conflist")
|
||||
err = ioutil.WriteFile(cniPathName, b, 0644)
|
||||
err = ioutil.WriteFile(cniPathName, b, 0o644)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
f, err := os.Stat(cniPathName)
|
||||
t, err := fileTime(cniPathName)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
stat := f.Sys().(*syscall.Stat_t)
|
||||
network.Created = time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec))
|
||||
network.Created = t
|
||||
} else {
|
||||
network.Created = time.Now()
|
||||
}
|
||||
@@ -424,3 +422,17 @@ func parseOptions(networkOptions map[string]string, networkDriver string) (*opti
|
||||
}
|
||||
return opt, nil
|
||||
}
|
||||
|
||||
func fileTime(file string) (time.Time, error) {
|
||||
var st unix.Stat_t
|
||||
for {
|
||||
err := unix.Stat(file, &st)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
return time.Time{}, &os.PathError{Path: file, Op: "stat", Err: err}
|
||||
}
|
||||
}
|
||||
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec)), nil //nolint:unconvert // On some platforms Sec and Nsec are int32.
|
||||
}
|
||||
|
||||
1
vendor/github.com/containers/common/libnetwork/cni/config.go
generated
vendored
1
vendor/github.com/containers/common/libnetwork/cni/config.go
generated
vendored
@@ -17,7 +17,6 @@ import (
|
||||
|
||||
// NetworkCreate will take a partial filled Network and fill the
|
||||
// missing fields. It creates the Network and returns the full Network.
|
||||
// nolint:gocritic
|
||||
func (n *cniNetwork) NetworkCreate(net types.Network) (types.Network, error) {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user