summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-10-27 11:34:36 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-10-27 11:34:36 +0100
commit1f399f2ee89956e3c1006b3f85ebd9a86aeef5cd (patch)
tree2549abfecb76ed17e40832a0117b59eebfe232f5 /src/plugins
parentf126daa896f18c25f8c4d4d9c24b33cdab2bed4e (diff)
downloadweechat-1f399f2ee89956e3c1006b3f85ebd9a86aeef5cd.zip
Fix infinite loop in fifo plugin when removing fifo pipe
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/fifo/fifo.c14
1 files changed, 12 insertions, 2 deletions
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)