summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/osversion
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-05-18 10:05:03 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-05-20 10:21:27 +0200
commit898a8ad28514f90e13b05707a0ead148caa33541 (patch)
tree5992a9a2a39e17d335e8f468aa4f546c2a18c91c /vendor/github.com/Microsoft/hcsshim/osversion
parent8bc39f4a90a658e92305369cc2628e2a65874506 (diff)
downloadpodman-898a8ad28514f90e13b05707a0ead148caa33541.tar.gz
podman-898a8ad28514f90e13b05707a0ead148caa33541.tar.bz2
podman-898a8ad28514f90e13b05707a0ead148caa33541.zip
update c/common
Update containers common to the latest HEAD. Some bug fixes in libimage forced us to have a clearer separation between ordinary images and manifest lists. Hence, when looking up manifest lists without recursing into any of their instances, we need to use `LookupManifestList()`. Also account for some other changes in c/common (e.g., the changed order in the security labels). Further vendor the latest HEAD from Buildah which is required to get the bud tests to pass. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/osversion')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go b/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go
index 42e58403d..3ab3bcd89 100644
--- a/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go
+++ b/vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go
@@ -2,6 +2,7 @@ package osversion
import (
"fmt"
+ "sync"
"golang.org/x/sys/windows"
)
@@ -15,19 +16,26 @@ type OSVersion struct {
Build uint16
}
+var (
+ osv OSVersion
+ once sync.Once
+)
+
// Get gets the operating system version on Windows.
// The calling application must be manifested to get the correct version information.
func Get() OSVersion {
- var err error
- osv := OSVersion{}
- osv.Version, err = windows.GetVersion()
- if err != nil {
- // GetVersion never fails.
- panic(err)
- }
- osv.MajorVersion = uint8(osv.Version & 0xFF)
- osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
- osv.Build = uint16(osv.Version >> 16)
+ once.Do(func() {
+ var err error
+ osv = OSVersion{}
+ osv.Version, err = windows.GetVersion()
+ if err != nil {
+ // GetVersion never fails.
+ panic(err)
+ }
+ osv.MajorVersion = uint8(osv.Version & 0xFF)
+ osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
+ osv.Build = uint16(osv.Version >> 16)
+ })
return osv
}