summaryrefslogtreecommitdiff
path: root/src/pkg/net/port.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/port.go')
-rw-r--r--src/pkg/net/port.go18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/pkg/net/port.go b/src/pkg/net/port.go
index 21e3b48aa..a9cd98daf 100644
--- a/src/pkg/net/port.go
+++ b/src/pkg/net/port.go
@@ -11,13 +11,8 @@ import (
"net";
"once";
"os";
- "strconv";
)
-// The error returned by LookupPort when a network service
-// is not listed in the database.
-var ErrNoService = &Error{"unknown network service"};
-
var services map[string] map[string] int
var servicesError os.Error
@@ -65,13 +60,10 @@ func LookupPort(network, service string) (port int, err os.Error) {
network = "udp";
}
- m, ok := services[network];
- if !ok {
- return 0, ErrNoService;
- }
- port, ok = m[service];
- if !ok {
- return 0, ErrNoService;
+ if m, ok := services[network]; ok {
+ if port, ok = m[service]; ok {
+ return;
+ }
}
- return port, nil;
+ return 0, &AddrError{"unknown port", network + "/" + service};
}