diff --git a/ChangeLog b/ChangeLog index df2ddd12..59367c10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -2008-08-25 Nicolas François +2008-08-26 Nicolas François + + * src/chfn.c: Merge some translated messages. + * src/groupmems.c, src/groupadd.c, src/gpasswd.c, src/chsh.c, + src/chfn.c: Harmonize *_update() failure messages. + * src/groupmems.c: Harmonize gr_close() failure messages. + * src/newgrp.c: Harmonize "unknown GID" messages. + * src/newusers.c: Move the pwd declaration to a inner block scope. + +2008-08-26 Nicolas François * src/useradd.c: Harmonize some error messages. * src/userdel.c: Add log to syslog when the mail file could not be diff --git a/src/chfn.c b/src/chfn.c index 8e1fb8de..ae4185a5 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -190,25 +190,25 @@ static void new_fields (void) if (may_change_field ('f')) { change_field (fullnm, sizeof fullnm, _("Full Name")); } else { - printf (_("\tFull Name: %s\n"), fullnm); + printf (_("\t%s: %s\n"), _("Full Name"), fullnm); } if (may_change_field ('r')) { change_field (roomno, sizeof roomno, _("Room Number")); } else { - printf (_("\tRoom Number: %s\n"), roomno); + printf (_("\t%s: %s\n"), _("Room Number"), fullnm); } if (may_change_field ('w')) { change_field (workph, sizeof workph, _("Work Phone")); } else { - printf (_("\tWork Phone: %s\n"), workph); + printf (_("\t%s: %s\n"), _("Work Phone"), fullnm); } if (may_change_field ('h')) { change_field (homeph, sizeof homeph, _("Home Phone")); } else { - printf (_("\tHome Phone: %s\n"), homeph); + printf (_("\t%s: %s\n"), _("Home Phone"), fullnm); } if (amroot) { @@ -476,8 +476,8 @@ static void update_gecos (const char *user, char *gecos) */ if (pw_update (&pwent) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), - Prog, pw_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, pw_dbname (), pwent.pw_name); fail_exit (E_NOPERM); } diff --git a/src/chsh.c b/src/chsh.c index da138a9d..7fc8f59a 100644 --- a/src/chsh.c +++ b/src/chsh.c @@ -401,7 +401,8 @@ static void update_shell (const char *user, char *newshell) */ if (pw_update (&pwent) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, pw_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, pw_dbname (), pwent.pw_name); fail_exit (1); } diff --git a/src/gpasswd.c b/src/gpasswd.c index 84b80f68..78370d61 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -577,8 +577,9 @@ static void update_group (struct group *gr) { if (gr_update (gr) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", gr_dbname ())); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, gr_dbname (), gr->gr_name); + SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname (), gr->gr_name)); #ifdef WITH_AUDIT audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating /etc/group", @@ -589,8 +590,9 @@ static void update_group (struct group *gr) #ifdef SHADOWGRP if (is_shadowgrp && (sgr_update (sg) == 0)) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_WARN, "failed to prepare the new %s entry", sgr_dbname ())); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, sgr_dbname (), sg->sg_name); + SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", sgr_dbname (), sg->sg_name)); #ifdef WITH_AUDIT audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating /etc/gshadow", diff --git a/src/groupadd.c b/src/groupadd.c index 900ac8f9..69fc2b90 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -199,7 +199,8 @@ static void grp_update (void) */ if (gr_update (&grp) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, gr_dbname (), grp.gr_name); fail_exit (E_GRP_UPDATE); } #ifdef SHADOWGRP @@ -208,7 +209,8 @@ static void grp_update (void) */ if (is_shadow_grp && (sgr_update (&sgrp) == 0)) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, sgr_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, sgr_dbname (), sgrp.sg_name); fail_exit (E_GRP_UPDATE); } #endif /* SHADOWGRP */ diff --git a/src/groupmems.c b/src/groupmems.c index ed1d62fa..c7b1d782 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -286,7 +286,8 @@ int main (int argc, char **argv) grp->gr_mem = add_list (grp->gr_mem, adduser); if (gr_update (grp) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, gr_dbname (), grp->gr_name); fail_exit (13); } } else if (NULL != deluser) { @@ -299,20 +300,22 @@ int main (int argc, char **argv) grp->gr_mem = del_list (grp->gr_mem, deluser); if (gr_update (grp) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, gr_dbname (), grp->gr_name); fail_exit (13); } } else if (purge) { grp->gr_mem[0] = NULL; if (gr_update (grp) == 0) { fprintf (stderr, - _("%s: failed to prepare the new %s entry\n"), Prog, gr_dbname ()); + _("%s: failed to prepare the new %s entry '%s'\n"), + Prog, gr_dbname (), grp->gr_name); fail_exit (13); } } if (gr_close () == 0) { - fprintf (stderr, _("%s: failure while writing %s\n"), Prog, gr_dbname ()); + fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); SYSLOG ((LOG_ERR, "failure while writing %s", gr_dbname ())); fail_exit (EXIT_GROUP_FILE); } diff --git a/src/newgrp.c b/src/newgrp.c index 5a814ebf..82c05789 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -507,10 +507,11 @@ int main (int argc, char **argv) */ grp = xgetgrgid (pwd->pw_gid); if (NULL == grp) { - fprintf (stderr, _("unknown GID: %lu\n"), - (unsigned long) pwd->pw_gid); - SYSLOG ((LOG_CRIT, "unknown GID: %lu", - (unsigned long) pwd->pw_gid)); + fprintf (stderr, + _("%s: GID '%lu' does not exist\n"), + Prog, (unsigned long) pwd->pw_gid); + SYSLOG ((LOG_CRIT, "GID '%lu' does not exist", + (unsigned long) pwd->pw_gid)); goto failure; } else { group = grp->gr_name; diff --git a/src/newusers.c b/src/newusers.c index 321bb01b..ce700f0a 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -284,7 +284,6 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) } static int get_uid (const char *uid, uid_t *nuid) { - const struct passwd *pwd = NULL; /* * The first guess for the UID is either the numerical UID that the @@ -302,6 +301,7 @@ static int get_uid (const char *uid, uid_t *nuid) { *nuid = (uid_t) i; } else { if ('\0' != uid[0]) { + const struct passwd *pwd; /* local, no need for xgetpwnam */ pwd = getpwnam (uid); if (NULL == pwd) {