summaryrefslogtreecommitdiff
blob: 766734a4affe507ca428c2edaab93b0201482fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 57c33317f5c3f6d21a9b3c56f8d1e97179e4c457 Mon Sep 17 00:00:00 2001
From: "Anthony G. Basile" <blueness@gentoo.org>
Date: Sat, 4 Oct 2014 09:34:05 -0400
Subject: [PATCH] emulator/serial.c: use posix_openpt() instead of getpt()

getpt(3) is glibc-specific and is not provided on musl. Instead, we
use use posix_openpt(3) which is equivalent and portable.

Signed-off-by: Anthony G. Basile <blueness@gentoo.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