File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
1515 "reflect"
1616 "strings"
1717 "time"
18+ "unicode"
1819
1920 "github.com/checkpoint-restore/go-criu/v7"
2021 criurpc "github.com/checkpoint-restore/go-criu/v7/rpc"
@@ -183,7 +184,19 @@ func (c *Container) criuSupportsExtNS(t configs.NamespaceType) bool {
183184}
184185
185186func criuNsToKey (t configs.NamespaceType ) string {
186- return "extRoot" + strings .Title (configs .NsName (t )) + "NS" //nolint:staticcheck // SA1019: strings.Title is deprecated
187+ // Construct "extRoot" + capitalize(nsName) + "NS" without allocations.
188+ // Result format: "extRootNetNS", "extRootPidNS", etc.
189+ nsName := configs .NsName (t )
190+ out := make ([]byte , 0 , 32 )
191+ out = append (out , "extRoot" ... )
192+ // Capitalize the first character (this assumes it's in the a-z range).
193+ if len (nsName ) > 0 {
194+ out = append (out , byte (unicode .ToUpper (rune (nsName [0 ]))))
195+ out = append (out , nsName [1 :]... )
196+ }
197+ out = append (out , "NS" ... )
198+
199+ return string (out )
187200}
188201
189202func (c * Container ) handleCheckpointingExternalNamespaces (rpcOpts * criurpc.CriuOpts , t configs.NamespaceType ) error {
You can’t perform that action at this time.
0 commit comments