From 34f7ed1fc76dbbcd8f2984d4304ec24ead244b43 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 3 Jun 2010 15:27:43 +0200 Subject: Fix some rare or minor issues found with Clang 2.7 analyzer. --- fetchmail.h | 4 ++-- interface.c | 4 ++-- sink.c | 3 +++ transact.c | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fetchmail.h b/fetchmail.h index 11cbc751..aa58bcdd 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -422,8 +422,8 @@ struct msgblk /* message header parsed for open_sink() */ #define NUM_ZERO(n) ((n) < 0) #define NUM_SPECIFIED(n) ((n) != 0) -#define MULTIDROP(ctl) (ctl->wildcard || \ - ((ctl)->localnames && (ctl)->localnames->next)) +#define MULTIDROP(ctl) ((ctl)->wildcard || \ + ((ctl)->localnames && (ctl)->localnames->next)) /* * Note: tags are generated with an a%04d format from a 1-origin diff --git a/interface.c b/interface.c index 287eaf18..7bdd2de6 100644 --- a/interface.c +++ b/interface.c @@ -514,7 +514,7 @@ get_ifinfo(const char *ifname, ifinfo_t *ifinfo) } sin = (struct sockaddr_in *)info.rti_info[RTAX_NETMASK]; - if (!sin) + if (sin) { ifinfo->netmask = sin->sin_addr; } @@ -524,7 +524,7 @@ get_ifinfo(const char *ifname, ifinfo_t *ifinfo) * of non point-to-point link */ sin = (struct sockaddr_in *)info.rti_info[RTAX_BRD]; - if (!sin) + if (sin) { ifinfo->dstaddr = sin->sin_addr; } diff --git a/sink.c b/sink.c index 76cd2bb5..a3f5dea3 100644 --- a/sink.c +++ b/sink.c @@ -649,6 +649,9 @@ int stuffline(struct query *ctl, char *buf) int n, oldphase; char *last; + if (!buf) + return -1; + /* The line may contain NUL characters. Find the last char to use * -- the real line termination is the sequence "\n\0". */ diff --git a/transact.c b/transact.c index b01c2f37..6de2dfca 100644 --- a/transact.c +++ b/transact.c @@ -1238,8 +1238,9 @@ process_headers: for (idp = msgblk.recipients; idp; idp = idp->next) if (idp->val.status.mark == XMIT_ACCEPT) break; /* only report first address */ - snprintf(buf+1, sizeof(buf)-1, - "for <%s>", rcpt_address (ctl, idp->id, 1)); + if (idp) + snprintf(buf+1, sizeof(buf)-1, + "for <%s>", rcpt_address (ctl, idp->id, 1)); snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf)-1, " (%s); ", MULTIDROP(ctl) ? "multi-drop" : "single-drop"); -- cgit v1.2.3