summary refs log tree commit diff stats
path: root/src/common/util.c
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-07-21 16:16:00 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-07-21 16:16:00 +0200
commitd559401c50690c65993b519bb2e28754e46dd179 (patch)
tree37bea57847c2c9814d79b47915a753192269310d /src/common/util.c
parent0e3fbb01d7f9608f37597df33a0833a6f7b3f173 (diff)
Supposed fix for g_io_channel_read() deprecation
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 28352189..8a8adf02 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -392,11 +392,14 @@ int
 waitline2 (GIOChannel *source, char *buf, int bufsize)
 {
 	int i = 0;
-	int len;
+	gsize len;
+	GError *error = NULL;
 
 	while (1)
 	{
-		if (g_io_channel_read (source, &buf[i], 1, &len) != G_IO_ERROR_NONE)
+		g_io_channel_set_buffered (source, FALSE);
+		g_io_channel_set_encoding (source, NULL, &error);
+		if (g_io_channel_read_chars (source, &buf[i], 1, &len, &error) != G_IO_STATUS_NORMAL)
 			return -1;
 		if (buf[i] == '\n' || bufsize == i + 1)
 		{