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

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


On Mon, Apr 03, 2017 at 04:19:24PM +0100, Richard W.M. Jones wrote:
> 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 ();

I forgot to add that setsid() is also not necessary, but unlike
the ioctl it doesn't seem to do any harm.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list