From: Alejandro Colomar Date: Sun, 19 May 2024 00:05:16 +0000 (+0200) Subject: contrib/adduser.c: main(): Use strcpy/cat(3) instead of their pattern X-Git-Tag: 4.17.0-rc1~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53ea42e67f6ed3ca1f7eae69a3992774be627a45;p=thirdparty%2Fshadow.git contrib/adduser.c: main(): Use strcpy/cat(3) instead of their pattern Signed-off-by: Alejandro Colomar --- diff --git a/contrib/adduser.c b/contrib/adduser.c index c1c9b9d3d..444f8d6ec 100644 --- a/contrib/adduser.c +++ b/contrib/adduser.c @@ -118,6 +118,7 @@ #include #include + #define IMMEDIATE_CHANGE /* Expire newly created password, must be changed * immediately upon next login */ #define HAVE_QUOTAS /* Obvious */ @@ -291,12 +292,10 @@ main (void) printf ("Home Directory [%s/%s]: ", DEFAULT_HOME, usrname); fflush (stdout); safeget (dir, sizeof (dir)); - if (!strlen (dir)) - { /* hit return */ - sprintf (dir, "%s/%s", DEFAULT_HOME, usrname); - } + if (!strlen(dir)) /* hit return */ + sprintf(dir, "%s/%s", DEFAULT_HOME, usrname); else if (dir[strlen (dir) - 1] == '/') - sprintf (dir+strlen(dir), "%s", usrname); + strcat(dir, usrname); } else { @@ -308,7 +307,7 @@ main (void) fflush (stdout); safeget (shell, sizeof (shell)); if (!strlen (shell)) - sprintf (shell, "%s", DEFAULT_SHELL); + strcpy(shell, DEFAULT_SHELL); else { char *sh; @@ -327,7 +326,7 @@ main (void) else { printf ("Shell NOT in /etc/shells, DEFAULT used\n"); - sprintf (shell, "%s", DEFAULT_SHELL); + strcpy(shell, DEFAULT_SHELL); } } }