summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-11-27 13:58:18 +0000
committerBernhard Reutner-Fischer2006-11-27 13:58:18 +0000
commit8a0a83d503a7971895254efa9e79cf15ba1850d4 (patch)
tree92683b2f7a6b253df5c89f37d80288a0ea15513b /loginutils
parent2813ce2aad3ce78651dc3bf5d96f0ee15c75d0e0 (diff)
downloadbusybox-8a0a83d503a7971895254efa9e79cf15ba1850d4.zip
busybox-8a0a83d503a7971895254efa9e79cf15ba1850d4.tar.gz
- minor shrinkage
text data bss dec hex filename 773 0 80 853 355 vlock.o.orig 766 0 80 846 34e vlock.o
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/vlock.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index 7a44d94..1414613 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -27,10 +27,7 @@ static unsigned long o_lock_all;
static void release_vt(int signo)
{
- if (!o_lock_all)
- ioctl(vfd, VT_RELDISP, 1);
- else
- ioctl(vfd, VT_RELDISP, 0);
+ ioctl(vfd, VT_RELDISP, !o_lock_all);
}
static void acquire_vt(int signo)
@@ -50,6 +47,11 @@ int vlock_main(int argc, char **argv)
struct sigaction sa;
struct vt_mode vtm;
struct termios term;
+ uid_t uid = getuid();
+
+ pw = getpwuid(uid);
+ if (pw == NULL)
+ bb_error_msg_and_die("unknown uid %d", uid);
if (argc > 2) {
bb_show_usage();
@@ -57,10 +59,6 @@ int vlock_main(int argc, char **argv)
o_lock_all = getopt32(argc, argv, "a");
- if((pw = getpwuid(getuid())) == NULL) {
- bb_error_msg_and_die("unknown uid %d", getuid());
- }
-
vfd = xopen(CURRENT_TTY, O_RDWR);
if (ioctl(vfd, VT_GETMODE, &vtm) < 0) {