b***@public.gmane.org
2014-10-04 14:31:42 UTC
From: "Anthony G. Basile" <basile-***@public.gmane.org>
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.
Signed-off-by: Anthony G. Basile <basile-***@public.gmane.org>
---
emulator/serial.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/emulator/serial.c b/emulator/serial.c
index 9583be4..8b49dc6 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;
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.
Signed-off-by: Anthony G. Basile <basile-***@public.gmane.org>
---
emulator/serial.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/emulator/serial.c b/emulator/serial.c
index 9583be4..8b49dc6 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;
--
2.0.4
2.0.4