Skip to content

Commit

Permalink
Revert more of the netsplit print optimisation to fix crashes
Browse files Browse the repository at this point in the history
Now iterating over all servers to avoid crashes on server_ischannel(),
which is a macro for server->ischannel(), so it dies horribly when it's
null. Doesn't help that IS_IRC_SERVER() always returns true on null.
  • Loading branch information
dequis committed Jan 29, 2018
1 parent 243ae4b commit a4f99ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
16 changes: 7 additions & 9 deletions src/fe-common/irc/fe-netjoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,18 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *filter_channe
message before it. */
static void sig_print_starting(TEXT_DEST_REC *dest)
{
NETJOIN_SERVER_REC *rec;
GSList *tmp, *next;

if (printing_joins)
return;

if (!IS_IRC_SERVER(dest->server))
return;

if (!server_ischannel(dest->server, dest->target))
return;
for (tmp = joinservers; tmp != NULL; tmp = next) {
NETJOIN_SERVER_REC *server = tmp->data;

rec = netjoin_find_server(IRC_SERVER(dest->server));
if (rec != NULL && rec->netjoins != NULL)
print_netjoins(rec, NULL);
next = tmp->next;
if (server->netjoins != NULL)
print_netjoins(server, NULL);
}
}

static int sig_check_netjoins(void)
Expand Down
15 changes: 6 additions & 9 deletions src/fe-common/irc/fe-netsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,17 @@ static int check_server_splits(IRC_SERVER_REC *server)
message before it. */
static void sig_print_starting(TEXT_DEST_REC *dest)
{
IRC_SERVER_REC *rec;
GSList *tmp;

if (printing_splits)
return;

if (!IS_IRC_SERVER(dest->server))
return;

if (!server_ischannel(dest->server, dest->target))
return;
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
IRC_SERVER_REC *rec = tmp->data;

rec = IRC_SERVER(dest->server);
if (rec->split_servers != NULL)
print_splits(rec, NULL);
if (IS_IRC_SERVER(rec) && rec->split_servers != NULL)
print_splits(rec, NULL);
}
}

static int sig_check_splits(void)
Expand Down

0 comments on commit a4f99ae

Please sign in to comment.