Re-use existing variables, patch from Tito

This commit is contained in:
Glenn L McGrath 2003-05-13 16:31:15 +00:00
parent c9163fee91
commit 0a3b0106ab

View File

@ -3,6 +3,7 @@
* openvt.c - open a vt to run a command. * openvt.c - open a vt to run a command.
* *
* busyboxed by Quy Tonthat <quy@signal3.com> * busyboxed by Quy Tonthat <quy@signal3.com>
* hacked by Tito <farmatito@tiscali.it>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -39,8 +40,7 @@ int openvt_main(int argc, char **argv)
int fd; int fd;
int vtno; int vtno;
char vtname[sizeof VTNAME + 2]; char vtname[sizeof VTNAME + 2];
char * cmd = NULL;
char * cmd_args = NULL;
if (argc < 3) if (argc < 3)
bb_show_usage(); bb_show_usage();
@ -56,9 +56,8 @@ int openvt_main(int argc, char **argv)
sprintf(vtname, VTNAME, vtno); sprintf(vtname, VTNAME, vtno);
cmd = argv[2]; argv+=2;
cmd_args = xmalloc(80); argc-=2;
cmd_args[0] = '\0';
if((pid = fork()) == 0) { if((pid = fork()) == 0) {
/* leave current vt */ /* leave current vt */
@ -83,8 +82,7 @@ int openvt_main(int argc, char **argv)
dup(fd); dup(fd);
dup(fd); dup(fd);
execvp(cmd, &argv[2]); execvp(argv[0], argv);
/*execlp(cmd, cmd_args);*/
_exit(1); _exit(1);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;