Bug fix: check file descriptor after opening serial device.

This commit is contained in:
Daniel Beer 2010-08-13 19:08:27 +12:00
parent 9a4ef8a909
commit a59d1dc73b
1 changed files with 3 additions and 0 deletions

3
util.c
View File

@ -113,6 +113,9 @@ int open_serial(const char *device, int rate)
int fd = open(device, O_RDWR | O_NOCTTY);
struct termios attr;
if (fd < 0)
return -1;
tcgetattr(fd, &attr);
cfmakeraw(&attr);
cfsetispeed(&attr, rate);