veyron/runtimes/google/rt: fix build break for linux
Change-Id: Icce812ea4768d47033fd77848c366adf01deb71b
diff --git a/runtimes/google/rt/platform_linux.go b/runtimes/google/rt/platform_linux.go
index 9cdf9ac..1ca3182 100644
--- a/runtimes/google/rt/platform_linux.go
+++ b/runtimes/google/rt/platform_linux.go
@@ -10,16 +10,17 @@
"veyron2/security"
)
+// str converts the input byte slice to a string, ignoring everything following
+// a null character (including the null character).
func str(c []int8) string {
- r := ""
- for i, v := range c {
- if i == 0 {
- // strip terminating null
- return c[:i]
+ ret := make([]byte, 0, len(c))
+ for _, v := range c {
+ if v == 0 {
+ break
}
+ ret = append(ret, byte(v))
}
- // no terminating null
- return string(c)
+ return string(ret)
}
// Platform returns the description of the Platform this process is running on.