Skip to contentSkip to conversation

emulator/serial.c: use posix_openpt() instead of getpt()

PATCH Applied [email protected] 2 participants 3 messages Oct 4, 2014 – Oct 7, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 emulator/serial.c: use posix_openpt() instead of getpt()

From: "Anthony G. Basile" <[email protected]>

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.

---
 emulator/serial.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
emulator/serial.c +2 -1
index 9583be4..8b49dc6 100644
@@ -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;
Signature · 1 line
2.0.4
#1 lore raw

Hi Anthony,

Quoted 10 lines · On Sat, Oct 04, 2014, [email protected] wrote:

From: "Anthony G. Basile" <[email protected]>

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.

---
 emulator/serial.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks. I first had to remove the Signed-off-by line though since we don't don't use that convention for user space patches.

Johan

#2 lore raw
Quoted 14 lines · Johan Hedberg

Hi Anthony,

Quoted 10 lines · On Sat, Oct 04, 2014, [email protected] wrote:

From: "Anthony G. Basile" <[email protected]>

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.

---
  emulator/serial.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 5 lines

Applied, thanks. I first had to remove the Signed-off-by line though since we don't don't use that convention for user space patches.

Johan

That's fine.

Signature · 5 lines
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197