FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 12-01-2011, 09:59 PM
Will Woods
 
Default loader/serial.c: correctly switch controlling terminal (#732302)

So after loader picks which terminal it likes best, it opens it, uses
dup2() to replace its fd (0,1,2) with the new terminal, and then does:
setsid(); ioctl(0, TIOCSCTTY, NULL);
to switch its controlling terminal to the new terminal (on fd 0).

In commit b8886ea3, the code was refactored a bit and the ioctl() got
moved *above* the dup2(), which meant that fd 0 was still the *old*
terminal, so the ioctl() would have no useful effect.

This commit makes ioctl() operate on the correct fd, and changes NULL
to '0' (since ioctl takes an int arg, not a pointer).
---
loader/serial.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/loader/serial.c b/loader/serial.c
index 735ee9e..eeec12f 100644
--- a/loader/serial.c
+++ b/loader/serial.c
@@ -194,7 +194,7 @@ int init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline
}

setsid();
- if (ioctl(0, TIOCSCTTY, NULL))
+ if (ioctl(fd, TIOCSCTTY, 0))
fprintf(stderr, "could not set new controlling tty
");

if (dup2(fd, 0) == -1)
--
1.7.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 09:52 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org