[Libguestfs] [PATCH supermin] init: Don't perform ioctl (TIOCSCTTY).

Richard W.M. Jones rjones at redhat.com
Mon Apr 3 15:19:24 UTC 2017


Doing this breaks bash in virt-rescue with the error:

  bash: cannot set terminal process group (-1): Inappropriate ioctl for device
  bash: no job control in this shell

Also ^C etc does not work.

Removing this ioctl call fixes this.

I noticed the problem because supermin's init compiled with dietlibc
worked, since the dietlibc header files don't define TIOCSCTTY and
hence the ioctl was not called.
---
 init/init.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/init/init.c b/init/init.c
index e6fd0e6..aa6c25f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -240,10 +240,6 @@ main ()
 
   /* Make current process the controlling process of the tty. */
   setsid ();
-#ifdef TIOCSCTTY
-  if (ioctl (0, TIOCSCTTY, 1) == -1)
-    perror ("ioctl: TIOCSCTTY");
-#endif
 
   if (!quiet)
     fprintf (stderr, "supermin: creating /dev/root as block special %d:%d\n",
-- 
2.12.0




More information about the Libguestfs mailing list