Skip to contentSkip to conversation

pty: fix O_CLOEXEC for TIOCGPTPEER

PATCH In review Matthijs van Duin 2 participants 2 messages Jul 19, 2018 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pty: fix O_CLOEXEC for TIOCGPTPEER

It was being ignored because the flags were not passed to fd allocation.

Fixes 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")
---
 drivers/tty/pty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/pty.c +1 -1
index b0e2c4847a5d..678406e0948b 100644
@@ -625,7 +625,7 @@ int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
 	if (tty->driver != ptm_driver)
 		return -EIO;
 
-	fd = get_unused_fd_flags(0);
+	fd = get_unused_fd_flags(flags);
 	if (fd < 0) {
 		retval = fd;
 		goto err;
Signature · 1 line
2.18.0
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Matthijs van Duin

It was being ignored because the flags were not passed to fd allocation.

Fixes 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")
Quoted 18 lines
---
 drivers/tty/pty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/pty.c +1 -1
index b0e2c4847a5d..678406e0948b 100644
@@ -625,7 +625,7 @@ int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
 	if (tty->driver != ptm_driver)
 		return -EIO;
 
-	fd = get_unused_fd_flags(0);
+	fd = get_unused_fd_flags(flags);
 	if (fd < 0) {
 		retval = fd;
 		goto err;
Signature · 4 lines
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>