summaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-26 13:35:09 +0000
committerDenis Vlasenko2007-03-26 13:35:09 +0000
commit53091ecd20c294f0e0757a5f4e0d5c8c7b23b555 (patch)
treef4ae0be26d5debff091d2c976e77fa8050c6758c /console-tools
parentec1a4b5a521b5adf295bc757c25231910f8c854b (diff)
downloadbusybox-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.zip
busybox-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.gz
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')
-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 0584584..882563b 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -15,30 +15,21 @@
int openvt_main(int argc, char **argv);
int openvt_main(int argc, char **argv)
{
- int fd;
char vtname[sizeof(VC_FORMAT) + 2];
- if (argc < 3) {
+ if (argc < 3)
bb_show_usage();
- }
+
/* check for illegal vt number: < 1 or > 63 */
sprintf(vtname, VC_FORMAT, (int)xatou_range(argv[1], 1, 63));
-//FIXME NOMMU
- if (fork() == 0) {
- /* child */
- /* leave current vt (controlling tty) */
- setsid();
- /* and grab new one */
- fd = xopen(vtname, O_RDWR);
- /* Reassign stdin, stdout and sterr */
- dup2(fd, STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
- dup2(fd, STDERR_FILENO);
- while (fd > 2) close(fd--);
+ bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
+ /* grab new one */
+ close(0);
+ xopen(vtname, O_RDWR);
+ dup2(0, STDOUT_FILENO);
+ dup2(0, STDERR_FILENO);
- BB_EXECVP(argv[2], &argv[2]);
- _exit(1);
- }
- return EXIT_SUCCESS;
+ BB_EXECVP(argv[2], &argv[2]);
+ _exit(1);
}