Compare commits

...

2 Commits

Author SHA1 Message Date
Frank Denis 4d1cd67d4d Nits 2024-04-03 16:49:37 +02:00
Frank Denis 363d44919f Properly check for the sticky bit 2024-04-03 16:47:13 +02:00
4 changed files with 5 additions and 6 deletions

View File

@ -117,7 +117,6 @@ func handleColdStartClient(clientPc *net.UDPConn, cancelChannel chan struct{}, i
}
func addColdStartListener(
proxy *Proxy,
ipsMap *CaptivePortalMap,
listenAddrStr string,
captivePortalHandler *CaptivePortalHandler,
@ -191,7 +190,7 @@ func ColdStart(proxy *Proxy) (*CaptivePortalHandler, error) {
}
ok := false
for _, listenAddrStr := range listenAddrStrs {
err = addColdStartListener(proxy, &ipsMap, listenAddrStr, &captivePortalHandler)
err = addColdStartListener(&ipsMap, listenAddrStr, &captivePortalHandler)
if err == nil {
ok = true
}

View File

@ -176,7 +176,7 @@ func maybeWritableByOtherUsers(p string) (bool, string, error) {
return false, p, err
}
mode := st.Mode()
if mode&2 == 2 && !(st.IsDir() && mode&01000 == 01000) {
if mode.Perm()&2 != 0 && !(st.IsDir() && mode&os.ModeSticky == os.ModeSticky) {
return true, p, nil
}
p = path.Dir(p)

View File

@ -105,7 +105,7 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
return err
}
if err != nil || resp.Rcode != dns.RcodeSuccess {
if resp.Rcode != dns.RcodeSuccess {
return nil
}

View File

@ -144,7 +144,7 @@ func loadTestSourceNames(t *testing.T, d *SourceTestData) {
}
}
func generateFixtureState(t *testing.T, d *SourceTestData, suffix, file string, state SourceTestState) {
func generateFixtureState(_ *testing.T, d *SourceTestData, suffix, file string, state SourceTestState) {
if _, ok := d.fixtures[state]; !ok {
d.fixtures[state] = map[string]SourceFixture{}
}
@ -296,7 +296,7 @@ func prepSourceTestCache(t *testing.T, d *SourceTestData, e *SourceTestExpect, s
}
func prepSourceTestDownload(
t *testing.T,
_ *testing.T,
d *SourceTestData,
e *SourceTestExpect,
source string,