From 4c772eac025459d848a753a5b7e78721ded80e81 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 19 Jun 2015 09:03:43 +0200 Subject: fix various compiler warnings --- irc.c | 4 +++- sircbot-send.c | 2 +- sircbot.c | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/irc.c b/irc.c index 5832421..f4ec697 100644 --- a/irc.c +++ b/irc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "irc.h" @@ -25,7 +26,7 @@ static int tcp_connect(const char *host, int port) addr.sin_family = AF_INET; addr.sin_port = htons(port); memcpy(&addr.sin_addr, h->h_addr, h->h_length); - if (connect(sock, (struct sockaddr *) &addr, + if (connect(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in))) { close(sock); sock = -1; @@ -84,4 +85,5 @@ int irc_close(struct irc_session *s, const char *msg) close(s->fd); } free(s); + return 0; } diff --git a/sircbot-send.c b/sircbot-send.c index 6f109d3..80a79af 100644 --- a/sircbot-send.c +++ b/sircbot-send.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -25,7 +26,6 @@ int connect_channel(const char *channel_name) int main(int argc, char *argv[]) { - int i; int fd = connect_channel(argv[1]); char buf[2048]; diff --git a/sircbot.c b/sircbot.c index ebe2d34..6ac9122 100644 --- a/sircbot.c +++ b/sircbot.c @@ -8,7 +8,9 @@ Intended usage is git hook that sends commits, etc. #include #include +#include +#include #include #include #include @@ -18,6 +20,7 @@ Intended usage is git hook that sends commits, etc. #include #include #include +#include #include #include "irc.h" @@ -82,7 +85,6 @@ static int write_pid(const char *file) int daemonize(const char *pidfile, const char *logfile) { - int devnull, f; int pid = fork(); if (pid < 0) { perror("fork"); @@ -508,7 +510,7 @@ static int join_channels(struct sircbot_session *sb) static int irc_loop(struct sircbot_session *sb) { - int i, r, n, joined = 0; + int i, r, n; const int maxconn = sb->numchan * 128; const int maxfds = 1 + sb->numchan + maxconn; struct pollfd fds[maxfds]; @@ -669,7 +671,6 @@ int main(int argc, char *argv[]) while (1) { sb.sess = irc_connect(server, port, nick, pass); - char buf[256]; if (sb.sess == NULL) { log_err(server); -- cgit v1.2.3