mirror of
https://github.com/tmate-io/tmate.git
synced 2025-02-23 05:41:21 +01:00
Solaris bits.
This commit is contained in:
parent
9b0ff4cfc0
commit
085d68bcc2
@ -1,4 +1,4 @@
|
||||
/* $Id: forkpty-sunos.c,v 1.2 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: forkpty-sunos.c,v 1.3 2008-06-18 21:14:42 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -45,19 +45,29 @@ forkpty(int *master,
|
||||
if ((slave = open(path, O_RDWR)) == -1)
|
||||
goto out;
|
||||
|
||||
if (ioctl(slave, I_PUSH, "ptem") == -1)
|
||||
fatal("ioctl failed");
|
||||
if (ioctl(slave, I_PUSH, "ldterm") == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
goto out;
|
||||
case 0:
|
||||
close(*master);
|
||||
|
||||
setsid();
|
||||
if (ioctl(slave, TIOCSCTTY, NULL) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
if (ioctl(slave, I_PUSH, "ptem") == -1)
|
||||
fatal("ioctl failed");
|
||||
if (ioctl(slave, I_PUSH, "ldterm") == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
dup2(slave, 0);
|
||||
dup2(slave, 1);
|
||||
dup2(slave, 2);
|
||||
if (slave > 2)
|
||||
close(slave);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user