Gareth pointed out yesterday that the Unix terminal front end treats
[sgt/putty] / unix / uxser.c
index d647108..24b0124 100644 (file)
@@ -214,7 +214,16 @@ static const char *serial_configure(Serial serial, Config *cfg)
 #ifdef ONLCR
                         | ONLCR
 #endif
-                        | OCRNL | ONOCR | ONLRET);
+#ifdef OCRNL
+                        | OCRNL
+#endif
+#ifdef ONOCR
+                        | ONOCR
+#endif
+#ifdef ONLRET
+                        | ONLRET
+#endif
+                        );
     options.c_cc[VMIN] = 1;
     options.c_cc[VTIME] = 0;
 
@@ -257,6 +266,8 @@ static const char *serial_init(void *frontend_handle, void **backend_handle,
     if (serial->fd < 0)
        return "Unable to open serial port";
 
+    cloexec(serial->fd);
+
     err = serial_configure(serial, cfg);
     if (err)
        return err;