* lib/fields.c: Fixed typo from 2010-02-15. field insteadof cp

ought to be checked.
	* src/vipw.c: Use Prog instead of progname. This is needed since
	Prog is used in the library.
This commit is contained in:
nekral-guest 2011-07-08 19:56:18 +00:00
parent cc6eaf9584
commit 13873a8799
3 changed files with 24 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
* src/groupadd.c: Fix typo in comment.
* src/userdel.c: Fix typo from 2011-06-04. Report failure on the
mailfile instead of user_home.
* lib/fields.c: Fixed typo from 2010-02-15. field insteadof cp
ought to be checked.
* src/vipw.c: Use Prog instead of progname. This is needed since
Prog is used in the library.
2011-07-08 Nicolas François <nicolas.francois@centraliens.net> 2011-07-08 Nicolas François <nicolas.francois@centraliens.net>
* man/*.xml, man/config.xml.in: Add source and version * man/*.xml, man/config.xml.in: Add source and version

View File

@ -54,7 +54,7 @@ int valid_field (const char *field, const char *illegal)
const char *cp; const char *cp;
int err = 0; int err = 0;
if (NULL == cp) { if (NULL == field) {
return -1; return -1;
} }

View File

@ -61,7 +61,9 @@
/* /*
* Global variables * Global variables
*/ */
static const char *progname, *filename, *fileeditname; const char *Prog;
static const char *filename, *fileeditname;
static bool filelocked = false; static bool filelocked = false;
static bool createedit = false; static bool createedit = false;
static int (*unlock) (void); static int (*unlock) (void);
@ -158,26 +160,26 @@ static void vipwexit (const char *msg, int syserr, int ret)
if (createedit) { if (createedit) {
if (unlink (fileeditname) != 0) { if (unlink (fileeditname) != 0) {
fprintf (stderr, _("%s: failed to remove %s\n"), progname, fileeditname); fprintf (stderr, _("%s: failed to remove %s\n"), Prog, fileeditname);
/* continue */ /* continue */
} }
} }
if (filelocked) { if (filelocked) {
if ((*unlock) () == 0) { if ((*unlock) () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname); fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname);
SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname)); SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
/* continue */ /* continue */
} }
} }
if (NULL != msg) { if (NULL != msg) {
fprintf (stderr, "%s: %s", progname, msg); fprintf (stderr, "%s: %s", Prog, msg);
} }
if (0 != syserr) { if (0 != syserr) {
fprintf (stderr, ": %s", strerror (err)); fprintf (stderr, ": %s", strerror (err));
} }
(void) fputs ("\n", stderr); (void) fputs ("\n", stderr);
if (!quiet) { if (!quiet) {
fprintf (stdout, _("%s: %s is unchanged\n"), progname, fprintf (stdout, _("%s: %s is unchanged\n"), Prog,
filename); filename);
} }
exit (ret); exit (ret);
@ -297,7 +299,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
snprintf (buf, strlen (editor) + strlen (fileedit) + 2, snprintf (buf, strlen (editor) + strlen (fileedit) + 2,
"%s %s", editor, fileedit); "%s %s", editor, fileedit);
if (system (buf) != 0) { if (system (buf) != 0) {
fprintf (stderr, "%s: %s: %s\n", progname, editor, fprintf (stderr, "%s: %s: %s\n", Prog, editor,
strerror (errno)); strerror (errno));
exit (1); exit (1);
} else { } else {
@ -381,7 +383,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
if (rename (to_rename, file) == -1) { if (rename (to_rename, file) == -1) {
fprintf (stderr, fprintf (stderr,
_("%s: can't restore %s: %s (your changes are in %s)\n"), _("%s: can't restore %s: %s (your changes are in %s)\n"),
progname, file, strerror (errno), to_rename); Prog, file, strerror (errno), to_rename);
#ifdef WITH_TCB #ifdef WITH_TCB
if (tcb_mode) { if (tcb_mode) {
free (to_rename); free (to_rename);
@ -400,7 +402,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
#endif /* WITH_TCB */ #endif /* WITH_TCB */
if ((*file_unlock) () == 0) { if ((*file_unlock) () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), progname, fileeditname); fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname);
SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname)); SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
/* continue */ /* continue */
} }
@ -417,8 +419,8 @@ int main (int argc, char **argv)
(void) bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE); (void) textdomain (PACKAGE);
progname = ((a = strrchr (*argv, '/')) ? a + 1 : *argv); Prog = ((a = strrchr (*argv, '/')) ? a + 1 : *argv);
do_vipw = (strcmp (progname, "vigr") != 0); do_vipw = (strcmp (Prog, "vigr") != 0);
OPENLOG (do_vipw ? "vipw" : "vigr"); OPENLOG (do_vipw ? "vipw" : "vigr");
@ -479,7 +481,7 @@ int main (int argc, char **argv)
if (shadowtcb_set_user (user) == SHADOWTCB_FAILURE) { if (shadowtcb_set_user (user) == SHADOWTCB_FAILURE) {
fprintf (stderr, fprintf (stderr,
_("%s: failed to find tcb directory for %s\n"), _("%s: failed to find tcb directory for %s\n"),
progname, user); Prog, user);
return E_SHADOW_NOTFOUND; return E_SHADOW_NOTFOUND;
} }
tcb_mode = true; tcb_mode = true;