1 --- a/loginutils/chpasswd.c
2 +++ b/loginutils/chpasswd.c
3 @@ -97,6 +97,11 @@ int chpasswd_main(int argc UNUSED_PARAM,
5 crypt_make_pw_salt(salt, algo);
6 free_me = pass = pw_encrypt(pass, salt, 0);
10 + bb_perror_msg_and_die("password encryption failed");
14 /* This is rather complex: if user is not found in /etc/shadow,
15 --- a/loginutils/cryptpw.c
16 +++ b/loginutils/cryptpw.c
17 @@ -95,7 +95,7 @@ int cryptpw_main(int argc UNUSED_PARAM,
18 /* Supports: cryptpw -m sha256 PASS 'rounds=999999999$SALT' */
19 char salt[MAX_PW_SALT_LEN + sizeof("rounds=999999999$")];
22 + char *password, *hash;
23 const char *opt_m, *opt_S;
26 @@ -140,8 +140,12 @@ int cryptpw_main(int argc UNUSED_PARAM,
27 /* may still be NULL on EOF/error */
31 - puts(pw_encrypt(password, salt, 1));
33 + hash = pw_encrypt(password, salt, 1);
35 + bb_perror_msg_and_die("password encryption failed");
41 --- a/loginutils/passwd.c
42 +++ b/loginutils/passwd.c
43 @@ -187,6 +187,10 @@ int passwd_main(int argc UNUSED_PARAM, c
45 logmode = LOGMODE_STDIO;
46 bb_error_msg_and_die("password for %s is unchanged", name);
47 + } else if (newp[0] == 0) {
48 + logmode = LOGMODE_STDIO;
50 + bb_perror_msg_and_die("password encryption failed");
52 } else if (opt & OPT_lock) {