summaryrefslogtreecommitdiff
path: root/emulator/serial.c
diff options
context:
space:
mode:
authorAnthony G. Basile <basile@opensource.dyc.edu>2014-10-04 10:31:42 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-10-07 17:54:30 +0300
commit40f6359e91f5495c713a183465d61672e786d87e (patch)
tree0c3933ba1c83519269cc8c95ac6c2a41cef05a42 /emulator/serial.c
parenta0347f2340065abc8bc3711d11f5667877d985cb (diff)
downloadbluez-40f6359e91f5495c713a183465d61672e786d87e.tar.gz
emulator/serial.c: use posix_openpt() instead of getpt()
getpt(3) is glibc-specific and is not provided in musl and possibly other libc's. Instead, we use use posix_openpt(3) which is equivalent and portable.
Diffstat (limited to 'emulator/serial.c')
-rw-r--r--emulator/serial.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/emulator/serial.c b/emulator/serial.c
index 9583be49c..8b49dc67c 100644
--- a/emulator/serial.c
+++ b/emulator/serial.c
@@ -32,6 +32,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
#include <sys/param.h>
#include <sys/epoll.h>
#include <sys/uio.h>
@@ -160,7 +161,7 @@ static void open_pty(struct serial *serial)
{
enum btdev_type uninitialized_var(type);
- serial->fd = getpt();
+ serial->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (serial->fd < 0) {
perror("Failed to get master pseudo terminal");
return;