]> granicus.if.org Git - sudo/commitdiff
eliminated some strcat()'s
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 4 Feb 1996 07:28:43 +0000 (07:28 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 4 Feb 1996 07:28:43 +0000 (07:28 +0000)
logging.c

index e513f43488f1fcff84d11962eb30ccadbbfb593b..4c5c60994f2a063167cd7d55e5bf6bec9eaf3cbb 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -286,13 +286,21 @@ void log_error(code)
     if (code != VALIDATE_ERROR && !(code & GLOBAL_PROBLEM)) {
 
        /* stuff the command into the logline */
-       /* XXX - this could be sped up */
-       strcat(logline, cmnd);
-       strcat(logline, " ");
+       p = logline + strlen(logline);
+       strcpy(p, cmnd);
+
+       /* add a trailing space */
+       p += strlen(cmnd);
+       *p++ = ' ';
+       *p = '\0';
+
+       /* cat on command args if they exist */
        if (NewArgc > 1)
            for (a = &NewArgv[1]; *a; a++) {
-               strcat(logline, *a);
-               strcat(logline, " ");
+               strcpy(p, *a);
+               p += strlen(*a);
+               *p++ = ' ';
+               *p = '\0';
            }
     }