summaryrefslogtreecommitdiff
path: root/console-tools/openvt.c
diff options
context:
space:
mode:
authorRob Landley2006-03-10 23:16:25 +0000
committerRob Landley2006-03-10 23:16:25 +0000
commitead19306f5d6d5d5ef49165aa518e525de8e84b2 (patch)
tree50e2c88bee71b9c4da3b54f951d337c112a85c03 /console-tools/openvt.c
parentbc68cd14ccaebc17e7e03a08e51fddfb91007624 (diff)
downloadbusybox-ead19306f5d6d5d5ef49165aa518e525de8e84b2.zip
busybox-ead19306f5d6d5d5ef49165aa518e525de8e84b2.tar.gz
Cleanup patches from tito.
Diffstat (limited to 'console-tools/openvt.c')
-rw-r--r--console-tools/openvt.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 6bdf608..de6a19f 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -35,28 +35,19 @@
int openvt_main(int argc, char **argv)
{
int fd;
- char vtname[sizeof VC_FORMAT + 2];
+ char vtname[sizeof(VC_FORMAT) + 2];
- if (argc < 3)
- bb_show_usage();
-
+ if (argc < 3) {
+ bb_show_usage();
+ }
/* check for Illegal vt number: < 1 or > 12 */
- sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
-
- argv+=2;
- argc-=2;
+ sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 1, 12));
- if(fork() == 0) {
+ if (fork() == 0) {
/* leave current vt */
-
-#ifdef ESIX_5_3_2_D
- if (setpgrp() < 0) {
-#else
if (setsid() < 0) {
-#endif
-
- bb_perror_msg_and_die("Unable to set new session");
+ bb_perror_msg_and_die("setsid");
}
close(0); /* so that new vt becomes stdin */
@@ -67,7 +58,7 @@ int openvt_main(int argc, char **argv)
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
- execvp(argv[0], argv);
+ execvp(argv[2], &argv[2]);
_exit(1);
}
return EXIT_SUCCESS;