+ /* From here on, we cannot use stderr for error messages any more.
+ If a test fails, just abort. */
+
+ /* Check that fd = 0, 1, 2 are now open to the controlling terminal for the
+ current process and that it is a session of its own. */
+ {
+ int fd;
+ for (fd = 0; fd < 3; fd++)
+ if (!(tcgetpgrp (fd) == getpid ()))
+ abort ();
+ for (fd = 0; fd < 3; fd++)
+ {
+ int sid = tcgetsid (fd);
+ if (!(sid == -1 ? errno == ENOSYS : sid == getpid ()))
+ abort ();
+ }
+ }
+