aboutsummaryrefslogtreecommitdiff
path: root/console-tools/openvt.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
commit53091ecd20c294f0e0757a5f4e0d5c8c7b23b555 (patch)
treef4ae0be26d5debff091d2c976e77fa8050c6758c /console-tools/openvt.c
parentec1a4b5a521b5adf295bc757c25231910f8c854b (diff)
downloadbusybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.gz
busybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.bz2
busybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.zip
Attempt to get more applets compile for NOMMU.
TODO_config_nommu documents what I managed to compile so far (yay! msh works! cool). inetd, telnetd, httpd still do not compile. TODO Also make fork(), daemon() produce warnings on compile stage (in addition to erros on link stage).
Diffstat (limited to 'console-tools/openvt.c')
-rw-r--r--console-tools/openvt.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 0584584df..882563b29 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -15,30 +15,21 @@
15int openvt_main(int argc, char **argv); 15int openvt_main(int argc, char **argv);
16int openvt_main(int argc, char **argv) 16int openvt_main(int argc, char **argv)
17{ 17{
18 int fd;
19 char vtname[sizeof(VC_FORMAT) + 2]; 18 char vtname[sizeof(VC_FORMAT) + 2];
20 19
21 if (argc < 3) { 20 if (argc < 3)
22 bb_show_usage(); 21 bb_show_usage();
23 } 22
24 /* check for illegal vt number: < 1 or > 63 */ 23 /* check for illegal vt number: < 1 or > 63 */
25 sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 1, 63)); 24 sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 1, 63));
26 25
27//FIXME NOMMU 26 bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
28 if (fork() == 0) { 27 /* grab new one */
29 /* child */ 28 close(0);
30 /* leave current vt (controlling tty) */ 29 xopen(vtname, O_RDWR);
31 setsid(); 30 dup2(0, STDOUT_FILENO);
32 /* and grab new one */ 31 dup2(0, STDERR_FILENO);
33 fd = xopen(vtname, O_RDWR);
34 /* Reassign stdin, stdout and sterr */
35 dup2(fd, STDIN_FILENO);
36 dup2(fd, STDOUT_FILENO);
37 dup2(fd, STDERR_FILENO);
38 while (fd > 2) close(fd--);
39 32
40 BB_EXECVP(argv[2], &argv[2]); 33 BB_EXECVP(argv[2], &argv[2]);
41 _exit(1); 34 _exit(1);
42 }
43 return EXIT_SUCCESS;
44} 35}