diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-10 00:21:55 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-10 00:21:55 +0300 |
commit | 8ced1e5dc55b972addafb91e4c4f527d41b8ee8e (patch) | |
tree | 945b9ab14b9f07772e8ea1578bd60281091fd384 /loginutils | |
parent | 4653e442ba66bd4917a6069293d4daff9691c61f (diff) |
passwd: do not complain about /etc/shadow needlessly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/passwd.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index c1481c65e..b447af2f5 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -128,12 +128,20 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) /* getspnam_r may return 0 yet set result to NULL. * At least glibc 2.4 does this. Be extra paranoid here. */ struct spwd *result = NULL; - if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result) - || !result || strcmp(result->sp_namp, pw->pw_name) != 0) { - /* LOGMODE_BOTH */ - bb_error_msg("no record of %s in %s, using %s", + errno = 0; + if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result) != 0 + || !result /* no error, but no record found either */ + || strcmp(result->sp_namp, pw->pw_name) != 0 /* paranoia */ + ) { + if (errno != ENOENT) { + /* LOGMODE_BOTH */ + bb_perror_msg("no record of %s in %s, using %s", name, bb_path_shadow_file, bb_path_passwd_file); + } + /* else: /etc/shadow does not exist, + * apparently we are on a shadow-less system, + * no surprise there */ } else { pw->pw_passwd = result->sp_pwdp; } |