On Wed, Jun 6, 2012 at 1:01 AM, Regid Ichira <regi...@yahoo.com> 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-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/cah8gtdpf8rzyrhk_rjpw5ro+2xkzjohpk0hedd8t8np6crg...@mail.gmail.com