aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2010-06-03 15:27:43 +0200
committerMatthias Andree <matthias.andree@gmx.de>2010-06-03 16:06:23 +0200
commit34f7ed1fc76dbbcd8f2984d4304ec24ead244b43 (patch)
tree1ff4f4daa0e262a1ad243365a983ed4d7e70445e
parentf1c6a8ec2cf88cd7b857111e58fab7e72ede7d29 (diff)
downloadfetchmail-34f7ed1fc76dbbcd8f2984d4304ec24ead244b43.tar.gz
fetchmail-34f7ed1fc76dbbcd8f2984d4304ec24ead244b43.tar.bz2
fetchmail-34f7ed1fc76dbbcd8f2984d4304ec24ead244b43.zip
Fix some rare or minor issues found with Clang 2.7 analyzer.
-rw-r--r--fetchmail.h4
-rw-r--r--interface.c4
-rw-r--r--sink.c3
-rw-r--r--transact.c5
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");