chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / serial.c
index bd4450cfa92738e7fc0c0e30e67124179aa647a6..378457365296fa7bfe2f0cae2662269ffe92a96c 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.8  2008/02/23 13:05:58  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.7  2008/02/15 23:52:12  james
  * *** empty log message ***
  *
@@ -163,12 +166,25 @@ serial_open (char *path, int lock_mode)
   if (!l)
     return NULL;
 
-  default_termios (&termios);
 
   fd = open (path, O_RDWR | O_NOCTTY | O_NONBLOCK);
 
   set_nonblocking (fd);
 
+
+  if (tcgetattr (fd, &termios))
+    {
+      close (fd);
+      return NULL;
+    }
+  default_termios (&termios);
+
+  if (tcsetattr (fd, TCSANOW, &termios))
+    {
+      close (fd);
+      return NULL;
+    }
+
   t = (Serial *) malloc (sizeof (Serial));
 
   t->lock = l;