mirror of
https://github.com/sheumann/hush.git
synced 2024-08-20 04:28:57 +00:00
Cleanup patches from tito.
This commit is contained in:
parent
bc68cd14cc
commit
ead19306f5
@ -44,8 +44,8 @@ int chvt_main(int argc, char **argv)
|
||||
|
||||
fd = get_console_fd();
|
||||
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
|
||||
if((-1 == ioctl(fd, VT_ACTIVATE, num)) ||
|
||||
(-1 == ioctl(fd, VT_WAITACTIVE, num))) {
|
||||
if ((-1 == ioctl(fd, VT_ACTIVATE, num))
|
||||
|| (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
|
||||
bb_perror_msg_and_die("ioctl");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -37,11 +37,11 @@ int deallocvt_main(int argc, char *argv[])
|
||||
/* num = 0 deallocate all unused consoles */
|
||||
int num = 0;
|
||||
|
||||
switch(argc)
|
||||
{
|
||||
switch (argc) {
|
||||
case 2:
|
||||
if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
|
||||
if ((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) {
|
||||
bb_error_msg_and_die("0: illegal VT number");
|
||||
}
|
||||
/* Fallthrough */
|
||||
case 1:
|
||||
break;
|
||||
@ -49,7 +49,7 @@ int deallocvt_main(int argc, char *argv[])
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
if (-1 == ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
|
||||
if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {
|
||||
bb_perror_msg_and_die("VT_DISALLOCATE");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -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));
|
||||
sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 1, 12));
|
||||
|
||||
argv+=2;
|
||||
argc-=2;
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user