]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/: Remove unnecessary variables
authorAlejandro Colomar <alx@kernel.org>
Wed, 1 Jan 2025 14:56:08 +0000 (15:56 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 4 Jun 2025 04:25:02 +0000 (23:25 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/getdef.c
src/su.c
src/useradd.c
src/usermod.c

index b83a820dd30099aca931333f9735e0901e3eb5d9..e3ae142d5ca1685d0ae6b4ff139e5cfd3896c733 100644 (file)
@@ -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;
index 7718d1597c3b31a61ffbaa8cb65e77fdca967f68..19e818b2168c7d845436fece5152446b70d96db5 100644 (file)
--- 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);
        }
index 001d63f63c7f6ba4a8ebe60caa0aede271ad89e5..36b9b8f8d1e1ffe0a4c29554bfc157ea7d372911 100644 (file)
@@ -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;
                }
index 48649eb128c54369ef9f56e512bd7a46af46b21c..a0f4d7ddcf0151082995940a932332b79afbfd75 100644 (file)
@@ -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,