dtterm: fixes so job control will work.

This commit is contained in:
Jon Trulson
2012-06-18 16:01:17 -06:00
parent 62b669a6af
commit 91f7988cf3
2 changed files with 48 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ static char rcs_id[] = "$XConsortium: TermPrimGetPty-svr4.c /main/1 1996/04/21 1
#endif /* PTY_CLONE_DEVICE */
int _DtTermPrimGetPty(char **ptySlave, char **ptyMaster)
static int GetPty(char **ptySlave, char **ptyMaster)
{
char *c;
int ptyFd;
@@ -233,8 +233,26 @@ ok:
return(-1);
}
/* this is a public wrapper around the previous function that runs the
* previous function setuid root...
*/
int
_DtTermPrimSetupPty(char *ptySlave, int ptyFd)
_DtTermPrimGetPty(char **ptySlave, char **ptyMaster)
{
int retValue;
/* this function needs to be suid root... */
(void) _DtTermPrimToggleSuidRoot(True);
retValue = GetPty(ptySlave, ptyMaster);
/* we now need to turn off setuid root... */
(void) _DtTermPrimToggleSuidRoot(False);
return(retValue);
}
static int
SetupPty(char *ptySlave, int ptyFd)
{
/*
* The following "pushes" were done at GetPty time, but
@@ -262,12 +280,30 @@ _DtTermPrimSetupPty(char *ptySlave, int ptyFd)
}
#endif /* USE_STREAMS_TTCOMPAT */
#else /* linux */
chown(ptySlave, getuid(), getgid());
chmod(ptySlave, 0622);
#endif /* linux */
/* success... */
return(0);
}
int
_DtTermPrimSetupPty(char *ptySlave, int ptyFd)
{
int retValue;
/* this function needs to be suid root... */
(void) _DtTermPrimToggleSuidRoot(True);
retValue = SetupPty(ptySlave, ptyFd);
/* we now need to turn off setuid root... */
(void) _DtTermPrimToggleSuidRoot(False);
return(retValue);
}
void
_DtTermPrimReleasePty(char *ptySlave)
{