openpty.c revision 250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77
/*
* openpty: glibc implementation
*
* Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
*
* Authors:
* Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _XOPEN_SOURCE /* See feature_test_macros(7) */
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#define _PATH_DEVPTMX "/dev/ptmx"
{
if (master == -1)
return -1;
goto fail;
goto fail;
goto fail;
if (slave == -1)
goto fail;
/* XXX Should we ignore errors here? */
if (termp)
if (winp)
return 0;
fail:
return -1;
}