Don't close the master fd before returning if slave opens ok

This commit is contained in:
Ben Gras 2006-03-27 11:08:53 +00:00
parent 1c88703f7b
commit 9e2ee91082

View file

@ -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);
}
j++;
if (j == 16) break;