summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-04-27 15:44:21 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-04-27 15:44:21 +0200
commit3ecfd2ecdc127ebda529acec5e2b7473cb4a1399 (patch)
tree225298a2a4046d9dac7825d6d6c9c2ce16ac7954
parentpackaging et cetera (diff)
downloadircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar.gz
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar.bz2
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar.lz
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar.xz
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.tar.zst
ircxmpp-3ecfd2ecdc127ebda529acec5e2b7473cb4a1399.zip
-rw-r--r--Makefile2
-rw-r--r--main.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 26f6f02..19eccb9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
DESTDIR=/
CC = cc
-cflags = -O0 -Wall -I. -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe)
+cflags = -O0 -Wall -I. -Wformat-security -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe)
SRCFILE = main.c
CFGFILE = ircxmpp.conf
CFGDEST = ircxmpp
diff --git a/main.c b/main.c
index e38ec0a..4359e78 100644
--- a/main.c
+++ b/main.c
@@ -107,7 +107,8 @@ void bridge_forward (const char * from, const char * msg, struct ircxmpp * ircxm
irc_cmd_msg(bridge->irc, ircxmpp->channel, msg);
irc_run_once(bridge);
} else if (msg) {
- bridge->messages = realloc(bridge->messages, bridge->messages_length+1);
+ bridge->messages = realloc(bridge->messages,
+ sizeof(*bridge->messages) * (bridge->messages_length+1));
bridge->messages[bridge->messages_length++] = strdup(msg);
}
} /* msg can be NULL, in that case we only join. */
@@ -237,7 +238,7 @@ void dump_event (irc_session_t * s, const char * e, const char * o, const char *
for (unsigned int i = 0; i < c; i++) {
if (i)
fprintf(stderr, "|");
- fprintf(stderr, p[i]);
+ fprintf(stderr, "%s", p[i]);
}
fprintf(stderr, "]\n");
}
@@ -595,6 +596,9 @@ cont:
xmpp_conn_release(ircxmpp.conn);
xmpp_ctx_free(ircxmpp.ctx);
xmpp_shutdown();
+ irc_cmd_quit(ircxmpp.irc, "vsesplošni izklop programa");
+ irc_run_once_control(&ircxmpp); // verjetno je to potrebno, da pošlje quit
+ irc_destroy_session(ircxmpp.irc);
free(ircxmpp.ircnick);
free(ircxmpp.irchost);
return 0;