diff options
-rw-r--r-- | loginutils/vlock.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 7a44d9405..1414613de 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c | |||
@@ -27,10 +27,7 @@ static unsigned long o_lock_all; | |||
27 | 27 | ||
28 | static void release_vt(int signo) | 28 | static void release_vt(int signo) |
29 | { | 29 | { |
30 | if (!o_lock_all) | 30 | ioctl(vfd, VT_RELDISP, !o_lock_all); |
31 | ioctl(vfd, VT_RELDISP, 1); | ||
32 | else | ||
33 | ioctl(vfd, VT_RELDISP, 0); | ||
34 | } | 31 | } |
35 | 32 | ||
36 | static void acquire_vt(int signo) | 33 | static void acquire_vt(int signo) |
@@ -50,6 +47,11 @@ int vlock_main(int argc, char **argv) | |||
50 | struct sigaction sa; | 47 | struct sigaction sa; |
51 | struct vt_mode vtm; | 48 | struct vt_mode vtm; |
52 | struct termios term; | 49 | struct termios term; |
50 | uid_t uid = getuid(); | ||
51 | |||
52 | pw = getpwuid(uid); | ||
53 | if (pw == NULL) | ||
54 | bb_error_msg_and_die("unknown uid %d", uid); | ||
53 | 55 | ||
54 | if (argc > 2) { | 56 | if (argc > 2) { |
55 | bb_show_usage(); | 57 | bb_show_usage(); |
@@ -57,10 +59,6 @@ int vlock_main(int argc, char **argv) | |||
57 | 59 | ||
58 | o_lock_all = getopt32(argc, argv, "a"); | 60 | o_lock_all = getopt32(argc, argv, "a"); |
59 | 61 | ||
60 | if((pw = getpwuid(getuid())) == NULL) { | ||
61 | bb_error_msg_and_die("unknown uid %d", getuid()); | ||
62 | } | ||
63 | |||
64 | vfd = xopen(CURRENT_TTY, O_RDWR); | 62 | vfd = xopen(CURRENT_TTY, O_RDWR); |
65 | 63 | ||
66 | if (ioctl(vfd, VT_GETMODE, &vtm) < 0) { | 64 | if (ioctl(vfd, VT_GETMODE, &vtm) < 0) { |