From 9b44613202a6f2f080ec23746d0680dcef88628d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 5 Aug 2008 09:56:56 +0000 Subject: - don't free user-supplied string (via -e) - fix helptext function old new delta chpasswd_main 300 319 +19 packed_usage 24352 24344 -8 .rodata 122227 122195 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 19/-40) Total: -21 bytes --- include/usage.h | 6 +++--- loginutils/chpasswd.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/usage.h b/include/usage.h index 1f9d5621d..ae6d2bcb6 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2924,13 +2924,13 @@ "\n -u Unlock (re-enable) account" \ #define chpasswd_trivial_usage \ - USE_GETOPT_LONG("[--md5|--encrypt]") SKIP_GETOPT_LONG("[-m|-e]") + USE_GETOPT_LONG("[--md5|--encrypted]") SKIP_GETOPT_LONG("[-m|-e]") #define chpasswd_full_usage "\n\n" \ - "Read user:password information from stdin\n" \ + "Read user:password information from stdin " \ "and update /etc/passwd accordingly.\n" \ "\nOptions:" \ USE_GETOPT_LONG( \ - "\n -e,--encrypt Supplied passwords are in encrypted form" \ + "\n -e,--encrypted Supplied passwords are in encrypted form" \ "\n -m,--md5 Use MD5 encryption instead of DES" \ ) \ SKIP_GETOPT_LONG( \ diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 25145fd1c..c83d1dad7 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -65,8 +65,8 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) bb_info_msg("Password for '%s' changed", name); logmode = LOGMODE_STDIO; free(name); - free(pass); + if (!(opt & OPT_ENC)) + free(pass); } - - return 0; + return EXIT_SUCCESS; } -- cgit v1.2.3