summaryrefslogtreecommitdiff
path: root/src/pkg/net/port_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/port_unix.go')
-rw-r--r--src/pkg/net/port_unix.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pkg/net/port_unix.go b/src/pkg/net/port_unix.go
index 3cd9ca2aa..89558c1f0 100644
--- a/src/pkg/net/port_unix.go
+++ b/src/pkg/net/port_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin dragonfly freebsd linux netbsd openbsd
+// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
// Read system port mappings from /etc/services
@@ -10,12 +10,16 @@ package net
import "sync"
-var services map[string]map[string]int
+// services contains minimal mappings between services names and port
+// numbers for platforms that don't have a complete list of port numbers
+// (some Solaris distros).
+var services = map[string]map[string]int{
+ "tcp": {"http": 80},
+}
var servicesError error
var onceReadServices sync.Once
func readServices() {
- services = make(map[string]map[string]int)
var file *file
if file, servicesError = open("/etc/services"); servicesError != nil {
return
@@ -29,7 +33,7 @@ func readServices() {
if len(f) < 2 {
continue
}
- portnet := f[1] // "tcp/80"
+ portnet := f[1] // "80/tcp"
port, j, ok := dtoi(portnet, 0)
if !ok || port <= 0 || j >= len(portnet) || portnet[j] != '/' {
continue