* subshell.c (pty_open_master) [!HAVE_SCO && HAVE_GRANTPT]:

Don't try to close a file that wasn't opened.
This commit is contained in:
Pavel Roskin 2001-05-29 07:30:00 +00:00
parent 35e16ef9b0
commit 826a5594ac
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2001-05-29 Pavel Roskin <proski@gnu.org>
* subshell.c (pty_open_master) [!HAVE_SCO && HAVE_GRANTPT]:
Don't try to close a file that wasn't opened.
* xslint.c: Remove slang_init() and FIXME in the comment.
* main.c (main) [!HAVE_SLANG]: Don't call slang_init().

View File

@ -1158,8 +1158,10 @@ static int pty_open_master (char *pty_name)
strcpy (pty_name, "/dev/ptmx");
pty_master = open (pty_name, O_RDWR);
#endif
if (pty_master == -1
|| grantpt (pty_master) == -1 /* Grant access to slave */
if (pty_master == -1)
return -1;
if (grantpt (pty_master) == -1 /* Grant access to slave */
|| unlockpt (pty_master) == -1 /* Clear slave's lock flag */
|| !(slave_name = ptsname (pty_master))) /* Get slave's name */
{