summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd22b41)
raw | patch | inline | side by side (parent: fd22b41)
author | Max Kellermann <max.kellermann@gmail.com> | |
Sun, 19 Mar 2017 10:09:44 +0000 (11:09 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Sun, 19 Mar 2017 10:11:39 +0000 (11:11 +0100) |
src/plugin.c | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 8701d1e02ee8f2ad8eb74722d6676cdddebf38c8..05b83b70ff212d6ac94c59573fb4cc9fe41a57bb 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
/** the pipe to the plugin process, or -1 if none is currently
open */
int fd;
- /** the GLib channel of #fd */
- GIOChannel *channel;
- /** the GLib IO watch of #channel */
+ /** the GLib IO watch of #fd */
guint event_id;
/** the output of the current plugin */
GString *data;
static void
plugin_eof(struct plugin_cycle *cycle, struct plugin_pipe *p)
{
- g_io_channel_unref(p->channel);
close(p->fd);
p->fd = -1;
p->cycle = cycle;
p->fd = fd;
p->data = g_string_new(NULL);
- p->channel = g_io_channel_unix_new(fd);
- p->event_id = g_io_add_watch(p->channel, G_IO_IN|G_IO_HUP,
+ GIOChannel *channel = g_io_channel_unix_new(fd);
+ p->event_id = g_io_add_watch(channel, G_IO_IN|G_IO_HUP,
plugin_data, cycle);
+ g_io_channel_unref(channel);
}
static int
{
if (p->fd >= 0) {
g_source_remove(p->event_id);
- g_io_channel_unref(p->channel);
close(p->fd);
}
}