aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2025-10-29 16:39:57 +0100
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2025-10-29 16:39:57 +0100
commit9b788b919ae60b6e160e1afa02a9f6af3e3793b9 (patch)
tree4167529bc93ce575c10ae02cb11f05687eed0fea
parent391eb05dae82b7f9d73976cd87f1532e669eb0ff (diff)
core:net -> os2
-rw-r--r--core/net/dns.odin20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/net/dns.odin b/core/net/dns.odin
index ed8c00d6a..b3801f71f 100644
--- a/core/net/dns.odin
+++ b/core/net/dns.odin
@@ -23,11 +23,11 @@ package net
*/
@(require) import "base:runtime"
-import "core:mem"
-import "core:strings"
-import "core:time"
-import "core:os"
-import "core:math/rand"
+import "core:mem"
+import "core:strings"
+import "core:time"
+import os "core:os/os2"
+import "core:math/rand"
@(require) import "core:sync"
dns_config_initialized: sync.Once
@@ -367,7 +367,10 @@ unpack_dns_header :: proc(id: u16be, bits: u16be) -> (hdr: DNS_Header) {
load_resolv_conf :: proc(resolv_conf_path: string, allocator := context.allocator) -> (name_servers: []Endpoint, ok: bool) {
context.allocator = allocator
- res := os.read_entire_file_from_filename(resolv_conf_path) or_return
+ res, res_err := os.read_entire_file(resolv_conf_path, allocator)
+ if res_err != nil {
+ return {}, false
+ }
defer delete(res)
resolv_str := string(res)
@@ -407,7 +410,10 @@ load_resolv_conf :: proc(resolv_conf_path: string, allocator := context.allocato
load_hosts :: proc(hosts_file_path: string, allocator := context.allocator) -> (hosts: []DNS_Host_Entry, ok: bool) {
context.allocator = allocator
- res := os.read_entire_file_from_filename(hosts_file_path, allocator) or_return
+ res, res_err := os.read_entire_file(hosts_file_path, allocator)
+ if res_err != nil {
+ return {}, false
+ }
defer delete(res)
_hosts := make([dynamic]DNS_Host_Entry, 0, allocator)