ynezz/librs232 — pull request #8 by minoki (2012-12-21 10:40:48+00:00)
Title: Minor changes

These commits contains the following changes:

* Check if the port is open in rs232_set_*** (Posix)
Without this check, the following code does not generate error (it should):
```
struct rs232_port_t * p = rs232_init();
rs232_set_baud(p, RS232_BAUD_9600);
```
... because p->pt->fd is 0, which is a valid file descriptor.

* The Posix version of rs232_open is opening the port with O_NDELAY, but it's not removing O_NDELAY, because current code is ORing the flag:
```
flags = fcntl(ux->fd, F_GETFL);
flags |= O_NDELAY;
fcntl(ux->fd, F_SETFL, flags);
```
So I've fixed this.

* Changed function prototypes for rs232_set_device and rs232_write/_timeout.
These functions are not modifying the parameter (char *device and unsigned char *buf), so I added const modifiers to these functions.