OSDN Git Service

libgo http/cgi: Pass down environment variables for irix and solaris.
[pf3gnuchains/gcc-fork.git] / libgo / syscalls / errstr.go
1 // errstr.go -- Error strings.
2
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package syscall
8
9 func Errstr(errno int) string {
10         for len := Size_t(128); ; len *= 2 {
11                 b := make([]byte, len)
12                 r := libc_strerror_r(errno, &b[0], len)
13                 if r >= 0 {
14                         i := 0
15                         for b[i] != 0 {
16                                 i++
17                         }
18                         return string(b[:i])
19                 }
20                 if GetErrno() != ERANGE {
21                         return "Errstr failure"
22                 }
23         }
24 }