summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gatchat/gatutil.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gatchat/gatutil.c b/gatchat/gatutil.c
index 1306c616..cbe38794 100644
--- a/gatchat/gatutil.c
+++ b/gatchat/gatutil.c
@@ -140,16 +140,17 @@ gboolean g_at_util_setup_io(GIOChannel *io, GIOFlags flags)
G_IO_STATUS_NORMAL)
return FALSE;
- io_flags = g_io_channel_get_flags(io);
+ if (flags & G_IO_FLAG_SET_MASK) {
+ io_flags = g_io_channel_get_flags(io);
- io_flags |= (flags & G_IO_FLAG_SET_MASK);
+ io_flags |= (flags & G_IO_FLAG_SET_MASK);
- if (g_io_channel_set_flags(io, io_flags, NULL) !=
- G_IO_STATUS_NORMAL)
- return FALSE;
+ if (g_io_channel_set_flags(io, io_flags, NULL) !=
+ G_IO_STATUS_NORMAL)
+ return FALSE;
+ }
g_io_channel_set_close_on_unref(io, TRUE);
return TRUE;
}
-