Don't try to use tio if it is NULL.

This commit is contained in:
Nicholas Marriott 2009-09-20 18:31:16 +00:00
parent 6594af3729
commit b29d4affd8
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: forkpty-aix.c,v 1.3 2009-08-19 16:06:45 nicm Exp $ */
/* $Id: forkpty-aix.c,v 1.4 2009-09-20 18:31:16 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -70,7 +70,7 @@ forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
fatal("open failed");
close(fd);
if (tcsetattr(slave, TCSAFLUSH, tio) == -1)
if (tio != NULL && tcsetattr(slave, TCSAFLUSH, tio) == -1)
fatal("tcsetattr failed");
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
fatal("ioctl failed");

View File

@ -1,4 +1,4 @@
/* $Id: forkpty-sunos.c,v 1.7 2009-08-19 16:06:45 nicm Exp $ */
/* $Id: forkpty-sunos.c,v 1.8 2009-09-20 18:31:16 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -62,7 +62,7 @@ forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
if (ioctl(slave, I_PUSH, "ldterm") == -1)
fatal("ioctl failed");
if (tcsetattr(slave, TCSAFLUSH, tio) == -1)
if (tio != NULL && tcsetattr(slave, TCSAFLUSH, tio) == -1)
fatal("tcsetattr failed");
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
fatal("ioctl failed");