From 1f399f2ee89956e3c1006b3f85ebd9a86aeef5cd Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 27 Oct 2008 11:34:36 +0100 Subject: Fix infinite loop in fifo plugin when removing fifo pipe --- src/plugins/fifo/fifo.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index 3efb47e92..b439a2d73 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -126,9 +126,16 @@ fifo_create () void fifo_remove () { + /* remove fd hook */ + if (fifo_fd_hook) + { + weechat_unhook (fifo_fd_hook); + fifo_fd_hook = NULL; + } + + /* close FIFO pipe */ if (fifo_fd != -1) { - /* close FIFO pipe */ close (fifo_fd); fifo_fd = -1; } @@ -137,12 +144,14 @@ fifo_remove () if (fifo_filename) unlink (fifo_filename); + /* remove any unterminated message */ if (fifo_unterminated) { free (fifo_unterminated); fifo_unterminated = NULL; } - + + /* free filename */ if (fifo_filename) { free (fifo_filename); @@ -292,6 +301,7 @@ fifo_read () else { weechat_unhook (fifo_fd_hook); + fifo_fd_hook = NULL; close (fifo_fd); fifo_fd = open (fifo_filename, O_RDONLY | O_NONBLOCK); if (fifo_fd < 0) -- cgit v1.2.3