• Nils Goroll's avatar
    Add VSA_getsockname() · 2b63ee2d
    Nils Goroll authored
    Flexelint on Linux exhibits exactly the problem described by phk in
    his rant at the top of vsa.c, quote:
    
    	Do I need to tell you that static code analysis tools have a
    	really hard time coping with (struct suckaddr_storage), and
    	that they give a lot of false negatives which confuse people ?
    
    One instance of this issue:
    
    --- Module:   cache/cache_acceptor.c (C)
                                                   _
     #... _assert(!!((getsockname(sp->fd, (void*)&ss, &sl)) == 0)) /*lint -restore *
     #... getsockname(sp->fd, (void*)&ss, &sl)) == 0); } while (0)
    	AZ(getsockname(sp->fd, (void*)&ss, &sl));
    cache/cache_acceptor.c  330  Error 64: Type mismatch (arg. no. 2) (union
        __SOCKADDR_ARG = void *)
                                     _
     #... SA_Build(sa, &ss, sl)) != 0); } while (0)
    	AN(VSA_Build(sa, &ss, sl));
    cache/cache_acceptor.c  332  Warning 603: Symbol 'ss' (line 318) not
        initialized
    cache/cache_acceptor.c  318  Info 830: Location cited in prior message
                                                                      _
    			i = accept(ls->sock, (void*)&wa.acceptaddr,
    cache/cache_acceptor.c  458  Error 64: Type mismatch (arg. no. 2) (union
        __SOCKADDR_ARG = void *)
    
    There is one more in cache/cache_backend_probe.c
    
    As the purpose of VSA is to avoid exactly this kind of trouble, we
    provide a VSA-wrapper for getsockname.
    2b63ee2d
Name
Last commit
Last update
.circleci Loading commit data...
.github Loading commit data...
bin Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
m4 Loading commit data...
man Loading commit data...
tools Loading commit data...
vmod Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
.lgtm.yml Loading commit data...
.syntastic_c_config Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
flint.lnt Loading commit data...
varnish-legacy.m4 Loading commit data...
varnish.m4 Loading commit data...
varnishapi-uninstalled.pc.in Loading commit data...
varnishapi.pc.in Loading commit data...
vtc.am Loading commit data...