diff --git a/Makefile b/Makefile index 3f34ccd..bd07c05 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -LIBS = -lpthread +LIBS = -lpthread -lutil LDFLAGS = -g OBJECTS = AX25Control.o AX25Network.o \ diff --git a/PseudoTTYController.cpp b/PseudoTTYController.cpp index e853c52..71196bd 100644 --- a/PseudoTTYController.cpp +++ b/PseudoTTYController.cpp @@ -33,6 +33,7 @@ #include #include #include +#include CPseudoTTYController::CPseudoTTYController(const std::string& device, unsigned int speed, bool assertRTS) : @@ -48,9 +49,11 @@ bool CPseudoTTYController::open() { assert(m_fd == -1); - m_fd = ::posix_openpt(O_RDWR | O_NOCTTY | O_NDELAY); - if (m_fd < 0) { - LogError("Cannot open device - %s", m_device.c_str()); + int slavefd; + char buf[300]; + int result = ::openpty(&m_fd, &slavefd, buf, NULL,NULL); + if (result < 0) { + LogError("Cannot open device - %s - Errno : %d", m_device.c_str(), errno); return false; }