mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #4914 from osamakader/fix-stringsTitle-criu-linux
criu: replace deprecated strings.Title
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/checkpoint-restore/go-criu/v7"
|
||||
criurpc "github.com/checkpoint-restore/go-criu/v7/rpc"
|
||||
@@ -183,7 +184,19 @@ func (c *Container) criuSupportsExtNS(t configs.NamespaceType) bool {
|
||||
}
|
||||
|
||||
func criuNsToKey(t configs.NamespaceType) string {
|
||||
return "extRoot" + strings.Title(configs.NsName(t)) + "NS" //nolint:staticcheck // SA1019: strings.Title is deprecated
|
||||
// Construct "extRoot" + capitalize(nsName) + "NS" without allocations.
|
||||
// Result format: "extRootNetNS", "extRootPidNS", etc.
|
||||
nsName := configs.NsName(t)
|
||||
out := make([]byte, 0, 32)
|
||||
out = append(out, "extRoot"...)
|
||||
// Capitalize the first character (this assumes it's in the a-z range).
|
||||
if len(nsName) > 0 {
|
||||
out = append(out, byte(unicode.ToUpper(rune(nsName[0]))))
|
||||
out = append(out, nsName[1:]...)
|
||||
}
|
||||
out = append(out, "NS"...)
|
||||
|
||||
return string(out)
|
||||
}
|
||||
|
||||
func (c *Container) handleCheckpointingExternalNamespaces(rpcOpts *criurpc.CriuOpts, t configs.NamespaceType) error {
|
||||
|
||||
Reference in New Issue
Block a user