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).
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user