From 826a5594acc68d5658512fa9c023bfdd4a3c43e5 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 29 May 2001 07:30:00 +0000 Subject: [PATCH] * subshell.c (pty_open_master) [!HAVE_SCO && HAVE_GRANTPT]: Don't try to close a file that wasn't opened. --- src/ChangeLog | 3 +++ src/subshell.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e35ab13f6..4692c11fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2001-05-29 Pavel Roskin + * 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(). diff --git a/src/subshell.c b/src/subshell.c index 6b7831c2f..d1ec704c7 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -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 */ {