[hackers] [st] close master/slave pty in the shell process. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Thu, 26 Aug 2010 17:39:56 +0000 (UTC)

changeset: 91:b688fd476748
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Thu Aug 26 21:36:21 2010 +0200
files: st.c
description:
close master/slave pty in the shell process.

diff -r 5258f6b11f17 -r b688fd476748 st.c
--- a/st.c Thu Aug 26 21:34:37 2010 +0200
+++ b/st.c Thu Aug 26 21:36:21 2010 +0200
@@ -247,7 +247,7 @@
         if((m = posix_openpt(O_RDWR | O_NOCTTY)) < 0)
                 die("openpt failed: %s\n", SERRNO);
         if(grantpt(m) < 0)
- die("grandpt failed: %s\n", SERRNO);
+ die("grantpt failed: %s\n", SERRNO);
         if(unlockpt(m) < 0)
                 die("unlockpt failed: %s\n", SERRNO);
         if(!(pts = ptsname(m)))
@@ -265,7 +265,9 @@
                 dup2(s, STDOUT_FILENO);
                 dup2(s, STDERR_FILENO);
                 if(ioctl(s, TIOCSCTTY, NULL) < 0)
- die("ioctl TTIOCSTTY failed: %s\n", SERRNO);
+ die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
+ close(s);
+ close(m);
                 execsh();
                 break;
         default:
Received on Thu Aug 26 2010 - 19:39:56 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 26 2010 - 19:48:08 CEST