]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: handle empty environment variables on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Tue, 2 Sep 2014 22:56:31 +0000 (00:56 +0200)
committerDavid du Colombier <0intro@gmail.com>
Tue, 2 Sep 2014 22:56:31 +0000 (00:56 +0200)
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/137920044

src/pkg/runtime/env_plan9.go

index b6dcb4c1eaa09ee4a1e85cbd5fc0472eb070f31e..76e9867e030a5fea9fbdae6a56ea0dc212dfe821 100644 (file)
@@ -31,6 +31,10 @@ func gogetenv(key string) string {
                return ""
        }
        n := seek(fd, 0, 2) - 1
+       if n <= 0 {
+               close(fd)
+               return ""
+       }
 
        p := make([]byte, n)