OptionsItem.command_queue_size = 64;
OptionsItem.command_interval = 10;
OptionsItem.command_timeout = 180;
- OptionsItem.negcache = 0; /* 0 disabled negcache */
+ OptionsItem.negcache = 0; /* 0 disabled negcache */
OptionsItem.negcache_rebuild = 43200;
OptionsItem.pidfile = xstrdup("hopm.pid");
OptionsItem.dns_fdlimit = 50;
strlcpy(conffilebuf, filename, sizeof(conffilebuf));
- if ((conf_file = fopen(filename, "r")) == NULL)
+ conf_file = fopen(filename, "r");
+ if (conf_file == NULL)
{
log_printf("CONFIG -> Error opening %s: %s", filename, strerror(errno));
exit(EXIT_FAILURE);
dnsbl_report(const struct scan_struct *ss)
{
char buf[2048], cmdbuf[256];
- FILE *fp;
assert(ss->ip);
if (OPT_DEBUG >= 3)
log_printf("DNSBL -> Sending following email:\n%s\n", buf);
- if ((fp = popen(cmdbuf, "w")) == NULL)
+ FILE *fp = popen(cmdbuf, "w");
+ if (fp == NULL)
{
log_printf("DNSBL -> Failed to create pipe to '%s' for email report!", cmdbuf);
irc_send_channels("I was trying to create a pipe to '%s' to send a DNSBL "
static void
m_invite(char *parv[], unsigned int parc, const char *msg, const char *source_p)
{
- const struct ChannelConf *channel = NULL;
-
if (parc < 4)
return;
log_printf("IRC -> Invited to %s by %s", parv[3], parv[0]);
- if ((channel = get_channel(parv[3])) == NULL)
+ const struct ChannelConf *channel = get_channel(parv[3]);
+ if (channel == NULL)
return;
irc_send("JOIN %s %s", channel->name, channel->key);
static void
m_privmsg(char *parv[], unsigned int parc, const char *msg, const char *source_p)
{
- const struct ChannelConf *channel = NULL;
-
if (source_p == NULL)
return;
return;
/* Get a target */
- if ((channel = get_channel(parv[2])) == NULL)
+ const struct ChannelConf *channel = get_channel(parv[2]);
+ if (channel == NULL)
return;
int hit = strncasecmp(parv[3], "!all ", 5) == 0;
static void
m_cannot_join(char *parv[], unsigned int parc, const char *msg, const char *source_p)
{
- const struct ChannelConf *channel = NULL;
-
if (parc < 5)
return;
/* Is it one of our channels? */
- if ((channel = get_channel(parv[3])) == NULL)
+ const struct ChannelConf *channel = get_channel(parv[3]);
+ if (channel == NULL)
return;
if (EmptyString(channel->invite))
static void
irc_init(void)
{
- const void *address = NULL;
+ const void *address;
assert(IRC_FD == -1);
if (!EmptyString(IRCItem.vhost))
{
struct addrinfo hints, *res;
- int n;
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_NUMERICHOST;
- if ((n = getaddrinfo(IRCItem.vhost, NULL, &hints, &res)))
+ int n = getaddrinfo(IRCItem.vhost, NULL, &hints, &res);
+ if (n)
{
log_printf("IRC -> error binding to %s: %s", IRCItem.vhost, gai_strerror(n));
exit(EXIT_FAILURE);
{
va_list arglist;
char buf[MSGLENMAX];
- size_t len = 0;
va_start(arglist, data);
- len = vsnprintf(buf, sizeof(buf), data, arglist);
+ size_t len = vsnprintf(buf, sizeof(buf), data, arglist);
va_end(arglist);
if (OPT_DEBUG >= 2)