From: Alejandro Colomar Date: Wed, 1 Jan 2025 14:56:08 +0000 (+0100) Subject: lib/, src/: Remove unnecessary variables X-Git-Tag: 4.18.0-rc1~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9466b8c83bd20eb4c20f4a84f2e12e93882a1ec8;p=thirdparty%2Fshadow.git lib/, src/: Remove unnecessary variables Signed-off-by: Alejandro Colomar --- diff --git a/lib/getdef.c b/lib/getdef.c index b83a820dd..e3ae142d5 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -456,13 +456,9 @@ out: void setdef_config_file (const char* file) { #ifdef USE_ECONF - char *cp; - - cp = xaprintf("%s/%s", file, sysconfdir); - sysconfdir = cp; + sysconfdir = xaprintf("%s/%s", file, sysconfdir); #ifdef VENDORDIR - cp = xaprintf("%s/%s", file, vendordir); - vendordir = cp; + vendordir = xaprintf("%s/%s", file, vendordir); #endif #else def_fname = file; diff --git a/src/su.c b/src/su.c index 7718d1597..19e818b21 100644 --- a/src/su.c +++ b/src/su.c @@ -1205,15 +1205,12 @@ int main (int argc, char **argv) * case they will be provided to the new user's shell as arguments. */ if (fakelogin) { - char *arg0; - cp = getdef_str ("SU_NAME"); if (NULL == cp) { cp = Basename (shellstr); } - arg0 = xaprintf("-%s", cp); - cp = arg0; + cp = xaprintf("-%s", cp); } else { cp = Basename (shellstr); } diff --git a/src/useradd.c b/src/useradd.c index 001d63f63..36b9b8f8d 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -430,14 +430,10 @@ get_defaults(void) if (streq(ccp, "")) ccp = SKEL_DIR; - if (prefix[0]) { - char *dt; - - dt = xaprintf("%s/%s", prefix, ccp); - def_template = dt; - } else { + if (prefix[0]) + def_template = xaprintf("%s/%s", prefix, ccp); + else def_template = xstrdup(ccp); - } } /* @@ -448,10 +444,7 @@ get_defaults(void) ccp = USRSKELDIR; if (prefix[0]) { - char *dut; - - dut = xaprintf("%s/%s", prefix, ccp); - def_usrtemplate = dut; + def_usrtemplate = xaprintf("%s/%s", prefix, ccp); } else { def_usrtemplate = xstrdup(ccp); } @@ -1518,16 +1511,10 @@ static void process_flags (int argc, char **argv) exit (E_BAD_NAME); } if (!dflg) { - char *uh; - - uh = xaprintf("%s/%s", def_home, user_name); - user_home = uh; + user_home = xaprintf("%s/%s", def_home, user_name); } if (prefix[0]) { - char *puh; /* to avoid const warning */ - - puh = xaprintf("%s/%s", prefix, user_home); - prefix_user_home = puh; + prefix_user_home = xaprintf("%s/%s", prefix, user_home); } else { prefix_user_home = user_home; } diff --git a/src/usermod.c b/src/usermod.c index 48649eb12..a0f4d7ddc 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -428,15 +428,12 @@ usage (int status) static char *new_pw_passwd (char *pw_pass) { if (Lflg && ('!' != pw_pass[0])) { - char *buf; - #ifdef WITH_AUDIT audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating-passwd", user_newname, user_newid, 1); #endif SYSLOG ((LOG_INFO, "lock user '%s' password", user_newname)); - buf = xaprintf("!%s", pw_pass); - pw_pass = buf; + pw_pass = xaprintf("!%s", pw_pass); } else if (Uflg && strprefix(pw_pass, "!")) { if (pw_pass[1] == '\0') { fprintf (stderr,