[BusyBox] New applet: openvt

Glenn McGrath bug1 at optushome.com.au
Sun Sep 15 12:47:03 UTC 2002


On Sat, 07 Sep 2002 00:27:20 +1000
Quy Tonthat <quy at signal3.com> wrote:

> Hi,
> Just a simple implementation of open that starts a vt on the console.
> I often use it for init to start up shell's on console. Hope it can be 
> any use
> for someone else.
> Quy
> 
> 

Im wondering, what is the purpose of the two dup(fd); statements in this
instance ?

+			/* and grab new one */
+			if ((fd = open(vtname, O_RDWR)) == -1)
+					perror_msg_and_die("could not open %s", vtname);	  
+			close(1);
+			close(2);
+			dup(fd);
+			dup(fd);
+			execvp(cmd, &argv[2]);
+			/*execlp(cmd, cmd_args);*/
+			_exit(1);
+	}
+	return EXIT_SUCCESS;
+}



Glenn



More information about the busybox mailing list