[systemd-devel] Warnings from recent commits
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Jul 20 19:18:44 PDT 2014
On Thu, Jul 17, 2014 at 08:51:52PM +0200, Thomas H.P. Andersen wrote:
> From recent commits I have noticed the following new issues from
> static analysis with scan-build and with clang. I am not sure how they
> should be fixed (or even if) but I just though I would let you know.
>
> 1) src/shared/barrier.c in barrier_read starting at line 274
>
> if (pfd[1].revents) {
> len = read(b->them, &buf, sizeof(buf));
> ...
> } else if (pfd[0].revents & (POLLHUP | POLLERR | POLLNVAL)) {
> ...
> buf = BARRIER_ABORTION;
> }
>
> If neither if/else if are true then buf will be used unset.
>
> 2) src/resolve/resolved-dns-scope.c in dns_scope_tcp_socket
> if s->link is null then ifindex will not be set but will be used later in:
>
> } else if (srv->family == AF_INET6) {
> sa.in6.sin6_port = htobe16(53);
> sa.in6.sin6_addr = srv->address.in6;
> sa.in6.sin6_scope_id = ifindex;
> salen = sizeof(sa.in6);
>
> 3) I see a couple of these:
>
> In file included from src/resolve/resolved-gperf.c:8:
> In file included from ./src/resolve/resolved.h:34:
> In file included from ./src/resolve/resolved-dns-query.h:33:
> In file included from ./src/resolve/resolved-dns-scope.h:33:
> ./src/resolve/resolved-dns-cache.h:45:3: warning: redefinition of
> typedef 'DnsCacheItem' is a C11 feature [-Wtypedef-redefinition]
> } DnsCacheItem;
> ^
> ./src/resolve/resolved-dns-cache.h:31:29: note: previous definition is here
> typedef struct DnsCacheItem DnsCacheItem;
I'd simply add -Wno-typedef-redefinition to CLAGS... This is one
of those cases where the medicine is worse than the disease.
Zbyszek
More information about the systemd-devel
mailing list