From: Ben Gras Date: Mon, 27 Mar 2006 11:08:53 +0000 (+0000) Subject: Don't close the master fd before returning if slave opens ok X-Git-Tag: v3.1.2a~118 X-Git-Url: http://zhaoyanbai.com/repos/icons/debian/static/doc/syslog.3.html?a=commitdiff_plain;h=9e2ee9108257dd3426b1d357fb04f11397293261;p=minix.git Don't close the master fd before returning if slave opens ok --- 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;