Hello community, here is the log from the commit of package mingetty for openSUSE:Factory checked in at Thu Dec 4 13:00:50 CET 2008. -------- --- mingetty/mingetty.changes 2008-07-21 12:41:27.000000000 +0200 +++ /mounts/work_src_done/STABLE/mingetty/mingetty.changes 2008-12-04 12:26:53.773232000 +0100 @@ -1,0 +2,5 @@ +Thu Dec 4 12:25:12 CET 2008 - werner@suse.de + +- Get the controlling tty only if we do not have it (bnc#447289) + +------------------------------------------------------------------- calling whatdependson for head-i586 New: ---- mingetty-1.0.7s-ctty.dif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mingetty.spec ++++++ --- /var/tmp/diff_new_pack.fS5753/_old 2008-12-04 12:59:30.000000000 +0100 +++ /var/tmp/diff_new_pack.fS5753/_new 2008-12-04 12:59:30.000000000 +0100 @@ -2,9 +2,16 @@ # spec file for package mingetty (Version 1.0.7s) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. -# This file and all modifications and additions to the pristine -# package are under the same license as the package itself. # +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + # Please submit bugfixes or comments via http://bugs.opensuse.org/ # @@ -16,12 +23,13 @@ Group: System/Base AutoReqProv: on Version: 1.0.7s -Release: 70 +Release: 91 Summary: Minimal Getty for Virtual Consoles Only Provides: sysvinit:/sbin/mingetty BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: mingetty-1.0.7s.tar.bz2 Patch: mingetty-1.0.7s.dif +Patch1: mingetty-1.0.7s-ctty.dif %description The mingetty program is a lightweight, minimalistic getty program for @@ -39,6 +47,7 @@ %prep %setup -q %patch +%patch1 %build %ifarch s390 s390x @@ -58,6 +67,8 @@ %doc %{_mandir}/man8/mingetty.8.gz %changelog +* Thu Dec 04 2008 werner@suse.de +- Get the controlling tty only if we do not have it (bnc#447289) * Mon Jul 21 2008 werner@suse.de - Use the enlarged buffer of last change * Fri Apr 25 2008 werner@suse.de ++++++ mingetty-1.0.7s-ctty.dif ++++++ --- mingetty.c +++ mingetty.c 2008-12-04 12:13:33.770687095 +0100 @@ -301,6 +301,7 @@ static void open_tty (void) sigset_t set; char buf[PATH_MAX+1]; int fd, len; + pid_t tid; gid_t gid = 0; struct group *gr = NULL; @@ -328,32 +329,41 @@ static void open_tty (void) sa.sa_handler = sigquit_handler; sigaction (SIGQUIT, &sa, NULL); - /* vhangup() will replace all open file descriptors in the kernel - that point to our controlling tty by a dummy that will deny - further reading/writing to our device. It will also reset the - tty to sane defaults, so we don't have to modify the tty device - for sane settings. We also get a SIGHUP/SIGCONT. - */ if ((fd = open (buf, O_RDWR, 0)) < 0) error ("%s: cannot open tty: %s", buf, strerror(errno)); if (!isatty (fd)) error ("%s: not a tty", buf); + if (((tid = tcgetsid(fd)) < 0) || (pid != tid)) { + if (ioctl (fd, TIOCSCTTY, 1) == -1) + error ("%s: cannot get controlling tty: %s", buf, strerror(errno)); + } + if (nohangup == 0) { + /* vhangup() will replace all open file descriptors in the kernel + that point to our controlling tty by a dummy that will deny + further reading/writing to our device. It will also reset the + tty to sane defaults, so we don't have to modify the tty device + for sane settings. We also get a SIGHUP/SIGCONT. + */ if (vhangup ()) error ("%s: vhangup() failed", tty); - /* Get rid of the present stdout/stderr. */ - close (2); - close (1); - close (0); - if (fd > 2) - close (fd); + (void)ioctl (fd, TIOCNOTTY); } + /* Get rid of the present stdout/stderr. */ + close (2); + close (1); + close (0); + if (fd > 2) + close (fd); + if ((fd = open (buf, O_RDWR, 0)) < 0) error ("%s: cannot open tty: %s", buf, strerror(errno)); - if (ioctl (fd, TIOCSCTTY, (void *)1) == -1) - error ("%s: cannot get controlling tty: %s", buf, strerror(errno)); + if ((nohangup == 0) && (((tid = tcgetsid(fd)) < 0) || (pid != tid))) { + if (ioctl (fd, TIOCSCTTY, 1) == -1) + error ("%s: cannot get controlling tty: %s", buf, strerror(errno)); + } if (tcsetpgrp(fd, pid)) error ("%s: cannot set process group: %s", buf, strerror(errno)); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org