Skip to content

Commit

Permalink
aghnet: fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Nov 7, 2022
1 parent a7d02fa commit 0d736fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ and this project adheres to



### Fixed

- Crash on Windows when system hosts files are read ([#5089]).

[#5089]: https://github.com/AdguardTeam/AdGuardHome/issues/5089



<!--
## [v0.107.18] - 2022-11-16 (APPROX.)
Expand Down Expand Up @@ -1088,7 +1096,7 @@ See also the [v0.106.0 GitHub milestone][ms-v0.106.0].
- Hostname uniqueness validation in the DHCP server ([#2952]).
- Hostname generating for DHCP clients which don't provide their own ([#2723]).
- New flag `--no-etc-hosts` to disable client domain name lookups in the
operating system's /etc/hosts files ([#1947]).
operating system's `/etc/hosts` files ([#1947]).
- The ability to set up custom upstreams to resolve PTR queries for local
addresses and to disable the automatic resolving of clients' addresses
([#2704]).
Expand Down
6 changes: 5 additions & 1 deletion internal/aghnet/hostscontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,11 @@ func (hc *HostsContainer) refresh() (err error) {
return fmt.Errorf("refreshing : %w", err)
}

if maps.EqualFunc(hp.table, hc.last, (*HostsRecord).equal) {
// hc.last is nil on the first refresh, so let that one through.
//
// TODO(a.garipov): Once https://github.com/golang/go/issues/56621 is
// resolved, remove the first condition.
if hc.last != nil && maps.EqualFunc(hp.table, hc.last, (*HostsRecord).equal) {
log.Debug("%s: no changes detected", hostsContainerPref)

return nil
Expand Down

0 comments on commit 0d736fb

Please sign in to comment.