Skip to content

Commit 8d2456d

Browse files
authored
Merge pull request moby#40246 from thaJeztah/system_windows_cleanup
pkg/system: minor cleanups and remove use of deprecated system.GetOSVersion()
2 parents db85ef5 + 044b74e commit 8d2456d

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

daemon/daemon_windows.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ func verifyDaemonSettings(config *config.Config) error {
222222
func checkSystem() error {
223223
// Validate the OS version. Note that dockerd.exe must be manifested for this
224224
// call to return the correct version.
225-
osv := system.GetOSVersion()
226-
if osv.MajorVersion < 10 {
225+
if osversion.Get().MajorVersion < 10 {
227226
return fmt.Errorf("This version of Windows does not support the docker daemon")
228227
}
229228
if osversion.Build() < osversion.RS1 {

pkg/parsers/operatingsystem/operatingsystem_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package operatingsystem // import "github.com/docker/docker/pkg/parsers/operatin
33
import (
44
"fmt"
55

6-
"github.com/docker/docker/pkg/system"
6+
"github.com/Microsoft/hcsshim/osversion"
77
"golang.org/x/sys/windows/registry"
88
)
99

@@ -52,7 +52,7 @@ func withCurrentVersionRegistryKey(f func(registry.Key) (string, error)) (string
5252

5353
// GetOperatingSystemVersion gets the version of the current operating system, as a string.
5454
func GetOperatingSystemVersion() (string, error) {
55-
version := system.GetOSVersion()
55+
version := osversion.Get()
5656
return fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build), nil
5757
}
5858

pkg/system/syscall_windows.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ func GetOSVersion() OSVersion {
8787
}
8888

8989
// IsWindowsClient returns true if the SKU is client
90-
// @engine maintainers - this function should not be removed or modified as it
91-
// is used to enforce licensing restrictions on Windows.
9290
func IsWindowsClient() bool {
9391
osviex := &osVersionInfoEx{OSVersionInfoSize: 284}
9492
r1, _, err := procGetVersionExW.Call(uintptr(unsafe.Pointer(osviex)))
@@ -102,7 +100,7 @@ func IsWindowsClient() bool {
102100

103101
// Unmount is a platform-specific helper function to call
104102
// the unmount syscall. Not supported on Windows
105-
func Unmount(dest string) error {
103+
func Unmount(_ string) error {
106104
return nil
107105
}
108106

@@ -123,7 +121,7 @@ func CommandLineToArgv(commandLine string) ([]string, error) {
123121

124122
newArgs := make([]string, argc)
125123
for i, v := range (*argv)[:argc] {
126-
newArgs[i] = string(windows.UTF16ToString((*v)[:]))
124+
newArgs[i] = windows.UTF16ToString((*v)[:])
127125
}
128126

129127
return newArgs, nil
@@ -150,7 +148,7 @@ func GetSecurityDescriptorDacl(securityDescriptor *byte, daclPresent *uint32, da
150148
r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0)
151149
if r1 == 0 {
152150
if e1 != 0 {
153-
result = syscall.Errno(e1)
151+
result = e1
154152
} else {
155153
result = syscall.EINVAL
156154
}

0 commit comments

Comments
 (0)