aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-06-19 09:03:43 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-06-19 09:10:45 +0200
commit4c772eac025459d848a753a5b7e78721ded80e81 (patch)
tree936dd52e8590c86e602f7cc6df21ec97269fc2be
parentf0984ed912b0343dd353a35de6d01768e021b217 (diff)
downloadsircbot-4c772eac025459d848a753a5b7e78721ded80e81.tar.bz2
sircbot-4c772eac025459d848a753a5b7e78721ded80e81.tar.xz
fix various compiler warnings
-rw-r--r--irc.c4
-rw-r--r--sircbot-send.c2
-rw-r--r--sircbot.c7
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#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 <sys/socket.h>
#include <sys/un.h>
+#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
@@ -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 <sys/socket.h>
#include <sys/un.h>
+#include <sys/wait.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@@ -18,6 +20,7 @@ Intended usage is git hook that sends commits, etc.
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
+#include <time.h>
#include <unistd.h>
#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);