aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/deallocvt.c
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2014-04-03 22:43:28 -0500
committerIsaac Dunham <ibid.ag@gmail.com>2014-04-03 22:43:28 -0500
commit6f9d481062e171fb0bd1aa5cdcf043c0e4f9d733 (patch)
tree2b50fcc1648c7b92e0e3659f0793642230f9d411 /toys/pending/deallocvt.c
parent547c8d980bb5ae37f8002aead4e155cc5554dfca (diff)
downloadtoybox-6f9d481062e171fb0bd1aa5cdcf043c0e4f9d733.tar.gz
openvt tries opening several devices to get an fd that points to the current console, without a need for read or write permissions. O_RDWR implies that both O_RDONLY and O_WRONLY would work, so skip it. Reindent.
Diffstat (limited to 'toys/pending/deallocvt.c')
-rw-r--r--toys/pending/deallocvt.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/toys/pending/deallocvt.c b/toys/pending/deallocvt.c
index 8ac67016..a8067d59 100644
--- a/toys/pending/deallocvt.c
+++ b/toys/pending/deallocvt.c
@@ -8,13 +8,13 @@ USE_DEALLOCVT(NEWTOY(deallocvt, ">1", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NEEDROOT))
config DEALLOCVT
bool "deallocvt"
- depends on OPENVT
+ depends on OPENVT
default n
help
- usage: deallocvt [N]
+ usage: deallocvt [N]
- Deallocate unused virtual terminal /dev/ttyN
- default value of N is 0, deallocate all unused consoles
+ Deallocate unused virtual terminal /dev/ttyN
+ default value of N is 0, deallocate all unused consoles
*/
#include "toys.h"
@@ -22,16 +22,16 @@ config DEALLOCVT
void deallocvt_main(void)
{
- int fd;
+ int fd;
- // 0 : deallocate all unused consoles
- int vt_num = 0;
+ // 0 : deallocate all unused consoles
+ int vt_num = 0;
- if (toys.optargs[0])
- vt_num = atolx_range(toys.optargs[0], 1, 63);
+ if (toys.optargs[0])
+ vt_num = atolx_range(toys.optargs[0], 1, 63);
- fd = find_console_fd();
- if (fd < 0) error_exit("can't open console");
+ fd = find_console_fd();
+ if (fd < 0) error_exit("can't open console");
- xioctl(fd, VT_DISALLOCATE, (void *)(ptrdiff_t)vt_num);
+ xioctl(fd, VT_DISALLOCATE, (void *)(ptrdiff_t)vt_num);
}