aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-06 21:09:04 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-06 21:15:03 +0200
commit22edb6d4899c647cfd33c13092d55c0904e90f0a (patch)
treecb3ba2b7669ad204b7acf9ec5ff83a7f2d0d58f1
parent9866675bb77beb24ee993360b748fb40e49f9512 (diff)
downloadliberty-22edb6d4899c647cfd33c13092d55c0904e90f0a.tar.gz
liberty-22edb6d4899c647cfd33c13092d55c0904e90f0a.tar.xz
liberty-22edb6d4899c647cfd33c13092d55c0904e90f0a.zip
Add a warning comment to "poller_fd::closed"
-rw-r--r--liberty-proto.c1
-rw-r--r--liberty.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/liberty-proto.c b/liberty-proto.c
index aa996de..0b873e3 100644
--- a/liberty-proto.c
+++ b/liberty-proto.c
@@ -1460,6 +1460,7 @@ mpd_client_reset (struct mpd_client *self)
xclose (self->socket);
self->socket = -1;
+ // FIXME: this is not robust wrt. forking
self->socket_event.closed = true;
poller_fd_reset (&self->socket_event);
poller_timer_reset (&self->timeout_timer);
diff --git a/liberty.c b/liberty.c
index 9848c1b..b59cde7 100644
--- a/liberty.c
+++ b/liberty.c
@@ -1326,6 +1326,9 @@ struct poller_fd
int fd; ///< Our file descriptor
short events; ///< The poll() events we registered for
+
+ // Make triple sure that no forked child is keeping the FD,
+ // otherwise we may access freed memory on Linux (poor epoll design)
bool closed; ///< Whether fd has been closed already
poller_fd_fn dispatcher; ///< Event dispatcher