ref: 68a437bb6d370781e18ad1b794cc34c21dd5b361
parent: 920b587c66cc2bb5169a117500deb9f8b00127fd
author: Ori Bernstein <[email protected]>
date: Thu Dec 21 19:03:07 EST 2017
Lock less in resolver. We could deadlock on init. Oops.
--- a/lib/std/resolve+posixy.myr
+++ b/lib/std/resolve+posixy.myr
@@ -90,6 +90,7 @@
dnscache = mkht()
loadhosts()
loadresolv()
+ initdone = true
;;
unlock(netlck)
;;
@@ -145,9 +146,7 @@
| `Some (ip, rest):
match ipparse(ip)
| `Some addr:
- lock(netlck)
addhosts(addr, ip, rest)
- unlock(netlck)
| `None:
/*
invalid addresses are ignored: we don't want to break stuff
@@ -194,7 +193,6 @@
var h
var lines
- lock(netlck)
match slurp(Resolvfile)
| `Ok d: h = d
| `Err m: -> void
@@ -218,7 +216,6 @@
;;
slfree(lines)
slfree(h)
- unlock(netlck)
}
const addns = {rest