From bcc85d50f5f39269713979c6509a9acd220570b8 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 28 Oct 2024 17:48:55 +0300 Subject: [PATCH] all: use aghos more --- internal/filtering/http.go | 3 ++- internal/home/auth.go | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/filtering/http.go b/internal/filtering/http.go index e459cb2f..08832b40 100644 --- a/internal/filtering/http.go +++ b/internal/filtering/http.go @@ -13,6 +13,7 @@ import ( "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" + "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/AdGuardHome/internal/filtering/rulelist" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" @@ -25,7 +26,7 @@ func (d *DNSFilter) validateFilterURL(urlStr string) (err error) { if filepath.IsAbs(urlStr) { urlStr = filepath.Clean(urlStr) - _, err = os.Stat(urlStr) + _, err = aghos.Stat(urlStr) if err != nil { // Don't wrap the error since it's informative enough as is. return err diff --git a/internal/home/auth.go b/internal/home/auth.go index 5b6cf9b8..040c70fd 100644 --- a/internal/home/auth.go +++ b/internal/home/auth.go @@ -90,7 +90,11 @@ func InitAuth( trustedProxies: trustedProxies, } var err error - a.db, err = bbolt.Open(dbFilename, aghos.DefaultPermFile, nil) + + opts := *bbolt.DefaultOptions + opts.OpenFile = aghos.OpenFile + + a.db, err = bbolt.Open(dbFilename, aghos.DefaultPermFile, &opts) if err != nil { log.Error("auth: open DB: %s: %s", dbFilename, err) if err.Error() == "invalid argument" {