From 9e2ee9108257dd3426b1d357fb04f11397293261 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 27 Mar 2006 11:08:53 +0000 Subject: [PATCH] Don't close the master fd before returning if slave opens ok --- lib/util/openpty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/util/openpty.c b/lib/util/openpty.c index 604b2bad5..ec6db2525 100644 --- a/lib/util/openpty.c +++ b/lib/util/openpty.c @@ -50,11 +50,10 @@ int openpty(int *amaster, int *aslave, char *name, if((*amaster = open(buff, O_RDWR)) >= 0) { sprintf(tty_name, "%s/tty%c%c", DEV_DIR, i, (j < 10) ? j + '0' : j + 'a' - 10); - if((*aslave = open(tty_name, O_RDWR)) >= 0) { + if((*aslave = open(tty_name, O_RDWR)) >= 0) break; - } - close(*amaster); } + close(*amaster); j++; if (j == 16) break; -- 2.44.0