* src/su.c: Avoid redeclaration of root_pw.

This commit is contained in:
nekral-guest 2009-05-10 18:20:41 +00:00
parent fe0a5b6ee3
commit 74073db5db
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2009-05-10 Nicolas François <nicolas.francois@centraliens.net>
* src/su.c: Avoid redeclaration of root_pw.
2009-05-10 NAKANO Takeo <nakano@webmasters.gr.jp> 2009-05-10 NAKANO Takeo <nakano@webmasters.gr.jp>
* po/ja.po: Updated Japanese translation. * po/ja.po: Updated Japanese translation.

View File

@ -460,16 +460,16 @@ int main (int argc, char **argv)
} }
} }
if ('\0' == name[0]) { /* use default user */ if ('\0' == name[0]) { /* use default user */
struct passwd *root_pw = getpwnam("root"); struct passwd *root_pw = getpwnam ("root");
if ((NULL != root_pw) && (0 == root_pw->pw_uid)) { if ((NULL != root_pw) && (0 == root_pw->pw_uid)) {
(void) strcpy (name, "root"); (void) strcpy (name, "root");
} else { } else {
struct passwd *root_pw = getpwuid(0); root_pw = getpwuid (0);
if (NULL == root_pw) { if (NULL == root_pw) {
SYSLOG((LOG_CRIT, "There is no UID 0 user.")); SYSLOG ((LOG_CRIT, "There is no UID 0 user."));
su_failure(tty); su_failure (tty);
} }
(void) strcpy(name, root_pw->pw_name); (void) strcpy (name, root_pw->pw_name);
} }
} }