Re: Why does login_tty(int fd) close fd at the end?
- From: Kushal Kumaran <kushal.kumaran+debian@xxxxxxxxx>
- Date: Wed, 6 Jun 2012 10:52:33 +0530
On Wed, Jun 6, 2012 at 1:01 AM, Regid Ichira <regid23@xxxxxxxxx> wrote:
Isn't closing fd at the end makes all the work meaningless?
$ man login_tty| grep -A6 'The login_tty() '
The login_tty() function prepares for a login on the tty fd
(which may be a real tty device, or the slave of a pseudoter-
minal as returned by openpty()) by creating a new session,
making fd the controlling terminal for the calling process,
setting fd to be the standard input, output, and error streams
of the current process, and closing fd..
Note the "setting fd to be the standard input, output, and error
streams" text. It will probably dup(2) the fd to be stdin, stdout,
and stderr. After that closing the original fd has no effect on the
newly created descriptors.
--
regards,
kushal
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/CAH8GtdPf8rZYrhk_RJPW5rO+2XkZJOHPk0HEDd8T8nP6crG-tw@xxxxxxxxxxxxxx
- References:
- Why does login_tty(int fd) close fd at the end?
- From: Regid Ichira
- Why does login_tty(int fd) close fd at the end?
- Prev by Date: System crashes for no apparent reason
- Next by Date: Re: [OT] Re: the ghost of UEFI and Micr0$0ft
- Previous by thread: Why does login_tty(int fd) close fd at the end?
- Next by thread: Wheezy as internet gateway: lost connections
- Index(es):
Relevant Pages
|