Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/fifo.c @ 1912:ee8657ff9aa8
Fix two fd leaks
author | franky |
---|---|
date | Fri, 14 May 2010 11:58:13 +0200 |
parents | e6d355e50d7a |
children | 7eadf86039e6 |
comparison
equal
deleted
inserted
replaced
1911:baa52ea32b47 | 1912:ee8657ff9aa8 |
---|---|
119 GSource *source; | 119 GSource *source; |
120 int fd = open (name, O_RDONLY|O_NONBLOCK); | 120 int fd = open (name, O_RDONLY|O_NONBLOCK); |
121 if (fd == -1) | 121 if (fd == -1) |
122 return FALSE; | 122 return FALSE; |
123 | 123 |
124 if (fifo_channel) | |
125 g_io_channel_unref(fifo_channel); | |
126 | |
124 fifo_channel = g_io_channel_unix_new(fd); | 127 fifo_channel = g_io_channel_unix_new(fd); |
125 | 128 |
126 g_io_channel_set_flags(fifo_channel, G_IO_FLAG_NONBLOCK, NULL); | 129 g_io_channel_set_flags(fifo_channel, G_IO_FLAG_NONBLOCK, NULL); |
127 g_io_channel_set_encoding(fifo_channel, NULL, NULL); | 130 g_io_channel_set_encoding(fifo_channel, NULL, NULL); |
128 g_io_channel_set_close_on_unref(fifo_channel, TRUE); | 131 g_io_channel_set_close_on_unref(fifo_channel, TRUE); |