MCPcopy Index your code
hub / github.com/containers/toolbox / systemdPathBusEscape

Function systemdPathBusEscape

src/cmd/create.go:975–991  ·  view source on GitHub ↗

systemdPathBusEscape sanitizes a constituent string of a dbus ObjectPath using the rules that systemd uses for serializing special characters.

(path string)

Source from the content-addressed store, hash-verified

973// systemdPathBusEscape sanitizes a constituent string of a dbus ObjectPath using the
974// rules that systemd uses for serializing special characters.
975func systemdPathBusEscape(path string) string {
976 // Special case the empty string
977 if len(path) == 0 {
978 return "_"
979 }
980 n := []byte{}
981 for i := 0; i < len(path); i++ {
982 c := path[i]
983 if systemdNeedsEscape(i, c) {
984 e := fmt.Sprintf("_%x", c)
985 n = append(n, []byte(e)...)
986 } else {
987 n = append(n, c)
988 }
989 }
990 return string(n)
991}
992
993func (err *promptForDownloadError) Error() string {
994 innerErr := err.Unwrap()

Callers 1

getServiceSocketFunction · 0.85

Calls 1

systemdNeedsEscapeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…