{
if (fd[0] >= 0)
close (fd[0]);
-#ifdef USG
+#if defined (USG) && !defined (IRIX)
setpgrp ();
#else
setpgrp (pid, pid);
close (out);
close (err);
-#ifdef USG
+#if defined (USG) && !defined (IRIX)
setpgrp (); /* No arguments but equivalent in this case */
#else
setpgrp (pid, pid);
ioctl (xforkin, TIOCSCTTY, 0);
#endif
#else /* not HAVE_SETSID */
-#ifdef USG
+#if defined (USG) && !defined (IRIX)
/* It's very important to call setpgrp() here and no time
afterwards. Otherwise, we lose our controlling tty which
is set when we open the pty. */
int j = open ("/dev/tty", O_RDWR, 0);
ioctl (j, TIOCNOTTY, 0);
close (j);
-#ifndef USG
+#if !defined (USG) || defined (IRIX)
/* In order to get a controlling terminal on some versions
of BSD, it is necessary to put the process in pgrp 0
before it opens the terminal. */