src/: Use xasprintf() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-05-13 14:37:14 +02:00
committed by Serge Hallyn
parent 44ba094766
commit d9923431eb
4 changed files with 10 additions and 15 deletions
+2 -3
View File
@@ -412,15 +412,14 @@ usage (int status)
static char *new_pw_passwd (char *pw_pass)
{
if (Lflg && ('!' != pw_pass[0])) {
char *buf = XMALLOC(strlen(pw_pass) + 2, char);
char *buf;
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"updating passwd", user_newname, user_newid, 0);
#endif
SYSLOG ((LOG_INFO, "lock user '%s' password", user_newname));
strcpy (buf, "!");
strcat (buf, pw_pass);
xasprintf(&buf, "!%s", pw_pass);
pw_pass = buf;
} else if (Uflg && pw_pass[0] == '!') {
if (pw_pass[1] == '\0') {