Skip to content

Commit ee77ddc

Browse files
committed
fix
1 parent 4f97208 commit ee77ddc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/src/serial_unix.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include <fstream>
21
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
32
#include "serial.h"
3+
#include <fstream>
44
#include <unistd.h> // UNIX standard function definitions
55
#include <fcntl.h> // File control definitions
66
#include <sys/ioctl.h> // Used for TCGETS2, which is required for custom baud rates
@@ -32,7 +32,13 @@ void serialOpen(
3232
// Open new serial connection
3333
hSerialPort = open(portName, O_RDWR);
3434

35-
log << strerror(errno);
35+
if(hSerialPort == -1){
36+
log << strerror(errno);
37+
}
38+
else {
39+
log << hSerialPort;
40+
}
41+
3642

3743
// Error if open fails
3844
ioctl(hSerialPort, TCGETS2, &tty);

0 commit comments

Comments
 (0)