Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
dd97923d
Commit
dd97923d
authored
Jan 27, 2010
by
Michael Hoisie
Committed by
Russ Cox
Jan 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: fix segfault if /etc/hosts fails to open or doesn't exist
R=rsc CC=golang-dev, r
https://golang.org/cl/194043
parent
5f4c052e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
hosts.go
src/pkg/net/hosts.go
+3
-1
No files found.
src/pkg/net/hosts.go
View file @
dd97923d
...
@@ -30,7 +30,9 @@ func readHosts() {
...
@@ -30,7 +30,9 @@ func readHosts() {
if
len
(
hosts
.
data
)
==
0
||
hosts
.
time
+
cacheMaxAge
<=
now
||
hosts
.
path
!=
hp
{
if
len
(
hosts
.
data
)
==
0
||
hosts
.
time
+
cacheMaxAge
<=
now
||
hosts
.
path
!=
hp
{
hs
:=
make
(
map
[
string
][]
string
)
hs
:=
make
(
map
[
string
][]
string
)
var
file
*
file
var
file
*
file
file
,
_
=
open
(
hp
)
if
file
,
_
=
open
(
hp
);
file
==
nil
{
return
}
for
line
,
ok
:=
file
.
readLine
();
ok
;
line
,
ok
=
file
.
readLine
()
{
for
line
,
ok
:=
file
.
readLine
();
ok
;
line
,
ok
=
file
.
readLine
()
{
if
i
:=
byteIndex
(
line
,
'#'
);
i
>=
0
{
if
i
:=
byteIndex
(
line
,
'#'
);
i
>=
0
{
// Discard comments.
// Discard comments.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment