summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-03-18 01:59:34 +0000
committerTiago Cunha <tcunha@gmx.com>2012-03-18 01:59:34 +0000
commit0987d552315b5781157846c23eee0ddaab4702d7 (patch)
treeae795f2be215e431d562f6985f1430c9022eaba7 /server-client.c
parent5aa28473dd76c6c10c5e2e9d303250c8f8881e05 (diff)
Sync OpenBSD patchset 1057:
Check event_initialized before event_del if event may not have been set up; libevent2 complains about this. Reported by Moriyoshi Koizumi.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/server-client.c b/server-client.c
index c53d0d97..a88230d4 100644
--- a/server-client.c
+++ b/server-client.c
@@ -152,11 +152,13 @@ server_client_lost(struct client *c)
evtimer_del(&c->repeat_timer);
- evtimer_del(&c->identify_timer);
+ if (event_initialized(&c->identify_timer))
+ evtimer_del(&c->identify_timer);
if (c->message_string != NULL)
xfree(c->message_string);
- evtimer_del(&c->message_timer);
+ if (event_initialized (&c->message_timer))
+ evtimer_del(&c->message_timer);
for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) {
msg = &ARRAY_ITEM(&c->message_log, i);
xfree(msg->msg);
@@ -175,7 +177,8 @@ server_client_lost(struct client *c)
close(c->ibuf.fd);
imsg_clear(&c->ibuf);
- event_del(&c->event);
+ if (event_initialized(&c->event))
+ event_del(&c->event);
for (i = 0; i < ARRAY_LENGTH(&dead_clients); i++) {
if (ARRAY_ITEM(&dead_clients, i) == NULL) {
} /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/local/bin/perl

$num=1;
$width=40;

while (<>)
	{
	chop;

	$i=length($_);

	$n=$width-$i;
	$i=int(($n+7)/8);
	print $_.("\t" x $i).$num."\n";
	$num++;
	}