Ahem: add new faq entry to list at top of FAQ.html
[oweals/busybox.git] / loginutils / vlock.c
index 7abf120d9250dc3557e63cec0ea5132eae75ca1b..b66a3b1ae162ab4faa916412bd2e0e15336904b4 100644 (file)
@@ -51,7 +51,7 @@ static int o_lock_all = 0;
 static struct spwd *spw;
 
 /* getspuid - get a shadow entry by uid */
-struct spwd *getspuid(uid_t uid)
+static struct spwd *getspuid(uid_t uid)
 {
        struct spwd *sp;
        struct passwd *mypw;
@@ -193,10 +193,9 @@ extern int vlock_main(int argc, char **argv)
 
                snprintf(prompt, 100, "%s's password: ", pw->pw_name);
 
-               if ((pass = getpass(prompt)) == NULL) {
-                       perror("getpass");
+               if ((pass = bb_askpass(0, prompt)) == NULL) {
                        restore_terminal();
-                       exit(1);
+                       bb_perror_msg_and_die("password");
                }
 
                crypt_pass = pw_encrypt(pass, pw->pw_passwd);
@@ -210,9 +209,8 @@ extern int vlock_main(int argc, char **argv)
                memset(crypt_pass, 0, strlen(crypt_pass));
 
                if (isatty(STDIN_FILENO) == 0) {
-                       perror("isatty");
                        restore_terminal();
-                       exit(1);
+                       bb_perror_msg_and_die("isatty");
                }
 
                sleep(++times);