unlink("/etc/mtab");
+ /* clean up anything handed to us by the kernel */
+ close(0);
+ close(1);
+ close(2);
+
/* loop until we can open the first terminal */
do {
close(1);
close(2);
setpgrp();
+ setpgid(0,0);
fdtty = open(ttyname, O_RDWR);
if (fdtty < 0)
void jobcontrol_in(struct tty *t)
{
- if (udata.u_ptab->p_pgrp == t->pgrp)
+ if (!t->pgrp || udata.u_ptab->p_pgrp == t->pgrp)
return;
/* We probably want to special case a helper here because we need
to handle the funnier side effects ? */
void jobcontrol_out(struct tty *t)
{
- if (udata.u_ptab->p_pgrp == t->pgrp)
+ if (!t->pgrp || udata.u_ptab->p_pgrp == t->pgrp)
return;
if (!(t->termios.c_lflag & TOSTOP))
return;