diff options
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/passwd.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index d0b2afc19..400ddb9a5 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -145,7 +145,6 @@ extern int passwd_main(int argc, char **argv) | |||
145 | int uflg = 0; /* -u - unlock account */ | 145 | int uflg = 0; /* -u - unlock account */ |
146 | int dflg = 0; /* -d - delete password */ | 146 | int dflg = 0; /* -d - delete password */ |
147 | const struct passwd *pw; | 147 | const struct passwd *pw; |
148 | unsigned short ruid; | ||
149 | 148 | ||
150 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 149 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS |
151 | const struct spwd *sp; | 150 | const struct spwd *sp; |
@@ -170,12 +169,8 @@ extern int passwd_main(int argc, char **argv) | |||
170 | bb_show_usage(); | 169 | bb_show_usage(); |
171 | } | 170 | } |
172 | } | 171 | } |
173 | ruid = getuid(); | 172 | myname = (char *) bb_xstrdup(my_getpwuid(NULL, getuid(), -1)); |
174 | pw = (struct passwd *) getpwuid(ruid); | 173 | /* exits on error */ |
175 | if (!pw) { | ||
176 | bb_error_msg_and_die("Cannot determine your user name."); | ||
177 | } | ||
178 | myname = (char *) bb_xstrdup(pw->pw_name); | ||
179 | if (optind < argc) { | 174 | if (optind < argc) { |
180 | name = argv[optind]; | 175 | name = argv[optind]; |
181 | } else { | 176 | } else { |