Skip to content

Commit e7fdaa9

Browse files
committed
core:net -> os2
1 parent 26e78f3 commit e7fdaa9

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

core/net/dns.odin

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ package net
2323
*/
2424

2525
@(require) import "base:runtime"
26-
import "core:mem"
27-
import "core:strings"
28-
import "core:time"
29-
import "core:os"
30-
import "core:math/rand"
26+
import "core:mem"
27+
import "core:strings"
28+
import "core:time"
29+
import os "core:os/os2"
30+
import "core:math/rand"
3131
@(require) import "core:sync"
3232

3333
dns_config_initialized: sync.Once
@@ -367,7 +367,10 @@ unpack_dns_header :: proc(id: u16be, bits: u16be) -> (hdr: DNS_Header) {
367367
load_resolv_conf :: proc(resolv_conf_path: string, allocator := context.allocator) -> (name_servers: []Endpoint, ok: bool) {
368368
context.allocator = allocator
369369

370-
res := os.read_entire_file_from_filename(resolv_conf_path) or_return
370+
res, res_err := os.read_entire_file(resolv_conf_path, allocator)
371+
if res_err != nil {
372+
return {}, false
373+
}
371374
defer delete(res)
372375
resolv_str := string(res)
373376

@@ -407,7 +410,10 @@ load_resolv_conf :: proc(resolv_conf_path: string, allocator := context.allocato
407410
load_hosts :: proc(hosts_file_path: string, allocator := context.allocator) -> (hosts: []DNS_Host_Entry, ok: bool) {
408411
context.allocator = allocator
409412

410-
res := os.read_entire_file_from_filename(hosts_file_path, allocator) or_return
413+
res, res_err := os.read_entire_file(hosts_file_path, allocator)
414+
if res_err != nil {
415+
return {}, false
416+
}
411417
defer delete(res)
412418

413419
_hosts := make([dynamic]DNS_Host_Entry, 0, allocator)

0 commit comments

Comments
 (0)