From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6425 Path: news.gmane.org!not-for-mail From: Felix Janda Newsgroups: gmane.linux.lib.musl.general Subject: Re: Add login_tty Date: Sun, 2 Nov 2014 15:19:12 +0100 Message-ID: <20141102141912.GA3637@euler> References: <20140825185756.GA6077@euler> <20140825224333.GX12888@brightrain.aerifal.cx> <20140826165627.GA1208@euler> <20141031161907.GD22465@brightrain.aerifal.cx> <20141101211523.GA13145@euler> <20141101214503.GK22465@brightrain.aerifal.cx> <20141101222729.GB5949@euler> <20141101224325.GM22465@brightrain.aerifal.cx> <20141101225643.GA8817@euler> <20141102000944.GN22465@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1414937992 12807 80.91.229.3 (2 Nov 2014 14:19:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Nov 2014 14:19:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6438-gllmg-musl=m.gmane.org@lists.openwall.com Sun Nov 02 15:19:46 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Xkw0P-0003yI-Bc for gllmg-musl@m.gmane.org; Sun, 02 Nov 2014 15:19:45 +0100 Original-Received: (qmail 30268 invoked by uid 550); 2 Nov 2014 14:19:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30257 invoked from network); 2 Nov 2014 14:19:43 -0000 X-Virus-Scanned: amavisd-new at posteo.de Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20141102000944.GN22465@brightrain.aerifal.cx> User-Agent: Mutt/1.5.22 (2013-10-16) Xref: news.gmane.org gmane.linux.lib.musl.general:6425 Archived-At: > > int login_tty(int fd) > > { > > int ret; > > setsid(); > > ret = ioctl(fd, TIOCSCTTY, (char *)0); > > dup2(fd, 0); > > dup2(fd, 1); > > dup2(fd, 2); > > if (fd>2) close(fd); > > return ret; > > } > > This behavior seems preferable in itself, but it's inconsistent with > what glibc and probably the BSDs do, so it's probably not a good idea. > glibc's behavior seems to match your previous version. This is leading > me to think maybe the code in forkpty should just stay separate. Do > you have other ideas? I've checked that Free- Net- and OpenBSD have the behavior of the previous version. Another approach would be to _exit in the child if login_tty fails. However the parent might interpret the exit code. Felix > Rich