[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another 1.10 job control bug?



Nicholas S Castellano writes:

> My old routine definitely does have a bug...Juergen's patch (WITH THE
> FIX I SENT OUT A DAY OR SO AGO) works a bit better.  For now, it would
> be best to use that scheme, and perhaps modify getty slightly to take
> any strange cases into account:  the first thing it should do is
> "steal" the terminal from any existing processes that think they own
> it, by changing the process group of the terminal.

 yes this is a patch i posted some time ago...  only i changed init not
getty. :)

Index: init/init.c
--- /i/tmp/init/init.c	Mon Aug  2 23:58:08 1993
+++ /f/msrc/ini11/init/init.c	Tue Aug 24 13:14:56 1993
@@ -44,6 +44,7 @@
 #include <sys/resource.h>
 
 #ifdef MINT
+#include <ioctl.h>
 #include <sys/dir.h>
 #include <mintbind.h>
 
@@ -493,12 +494,17 @@
 
 	if ((pid = vfork()) == 0)
 	{
-		setpgrp(getpid(), getpid());
+		long pgrp = setpgrp(getpid(), getpid());
 
 		tty = open(ttyname, O_RDWR);
 
 #ifdef MINT
+		if (tty == -1 || pgrp < 0) {
+			perror(ttyname);
+			_exit(0);
+		}
 		dup2(tty, -1);		/* set controlling terminal */
+		ioctl (-1, TIOCSPGRP, &pgrp);
 #endif
 		dup2(tty, 0);
 		dup2(tty, 1);

 cheers
	Juergen
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA