aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-02-21 12:33:15 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-02-21 12:33:15 +0100
commit3d440817896bf73945b91282aeb23d864ca9fcf8 (patch)
tree2d6ca0cdcd5ad8bf98a21f253d9aa3c332a31ffc
parentccf6b1427f94e8c0b495a6f93634004bd935cf5f (diff)
downloadxK-3d440817896bf73945b91282aeb23d864ca9fcf8.tar.gz
xK-3d440817896bf73945b91282aeb23d864ca9fcf8.tar.xz
xK-3d440817896bf73945b91282aeb23d864ca9fcf8.zip
ZyklonB: fix issues with plugin unloading
-rw-r--r--zyklonb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/zyklonb.c b/zyklonb.c
index 7edd343..d18b255 100644
--- a/zyklonb.c
+++ b/zyklonb.c
@@ -2159,12 +2159,17 @@ on_signal_pipe_readable (const struct pollfd *fd, struct bot_context *ctx)
plugin->pid = -1;
+ // In theory we could close `read_fd', set `read_event->closed' to true
+ // and expect epoll to no longer return events for the descriptor, as
+ // all the pipe ends should be closed by then (the child is dead, so its
+ // pipe FDs have been closed [assuming it hasn't forked without closing
+ // the descriptors, which would be evil], and we would have closed all
+ // of our FDs for this pipe as well). In practice that doesn't work.
+ poller_fd_reset (&plugin->read_event);
+
xclose (plugin->read_fd);
plugin->read_fd = -1;
- plugin->read_event.closed = true;
- poller_fd_reset (&plugin->read_event);
-
LIST_UNLINK (ctx->plugins, plugin);
plugin_data_free (plugin);
free (plugin);