drive: rewrite LOCK paths

Fixes #12097

Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
Percy Wegmann
2024-05-14 20:30:02 -05:00
committed by Percy Wegmann
parent 87f00d76c4
commit 59848fe14b
6 changed files with 380 additions and 87 deletions

View File

@@ -0,0 +1,16 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package shared
import (
"bytes"
"encoding/xml"
)
// EscapeForXML escapes the given string for use in XML text.
func EscapeForXML(s string) string {
result := bytes.NewBuffer(nil)
xml.Escape(result, []byte(s))
return result.String()
}