aboutsummaryrefslogtreecommitdiff
path: root/qga/channel-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'qga/channel-posix.c')
-rw-r--r--qga/channel-posix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 6796a02..568350d 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -149,6 +149,25 @@ static gboolean ga_channel_open(GAChannel *c, const gchar *path,
return false;
}
#endif
+#ifdef __FreeBSD__
+ /*
+ * In the default state channel sends echo of every command to a
+ * client. The client programm doesn't expect this and raises an
+ * error. Suppress echo by resetting ECHO terminal flag.
+ */
+ struct termios tio;
+ if (tcgetattr(fd, &tio) < 0) {
+ error_setg_errno(errp, errno, "error getting channel termios attrs");
+ close(fd);
+ return false;
+ }
+ tio.c_lflag &= ~ECHO;
+ if (tcsetattr(fd, TCSAFLUSH, &tio) < 0) {
+ error_setg_errno(errp, errno, "error setting channel termios attrs");
+ close(fd);
+ return false;
+ }
+#endif /* __FreeBSD__ */
ret = ga_channel_client_add(c, fd);
if (ret) {
error_setg(errp, "error adding channel to main loop");