]> andersk Git - moira.git/blobdiff - server/mr_util.c
Don't truncate query arguments at 40 characters in logs
[moira.git] / server / mr_util.c
index ca0c888d462dd5e4784b6704c5e00d4e81717363..8855b0c95fa2937b877530082493d5ae6541cb3a 100644 (file)
@@ -16,7 +16,6 @@ static char *rcsid_mr_util_c = "$Header$";
 #include "mr_server.h"
 
 #include <ctype.h>
-#include <strings.h>
 #include <sys/types.h>
 
 extern char *whoami;
@@ -30,7 +29,7 @@ requote(buf, cp, len)
        register unsigned char c;
        if (len <= 2) return buf;
        *buf++ = '"'; count++; len--;
-       for(; (count < 40) && (len > 1) && (c = *cp);
+       for(; (count < 258) && (len > 1) && (c = *cp);
            cp++, --len, ++count) {
                if (c == '\\' || c == '"') *buf++ = '\\';
                if (isprint(c)) *buf++ = c;
@@ -40,11 +39,6 @@ requote(buf, cp, len)
                }
        }
        if (len > 1) { *buf++ = '"'; count++; len--; }
-       if (len > 3 && count >= 40) {
-               *buf++ = '.'; count++; len--;
-               *buf++ = '.'; count++; len--;
-               *buf++ = '.'; count++; len--;
-       }
        if (len > 1) *buf = '\0';
        return buf;
 }
@@ -63,12 +57,12 @@ log_args(tag, version, argc, argv)
        sprintf(buf, "%s[%d]: ", tag, version);
        for (bp = buf; *bp; bp++);
        
-       for (i = 0; i < argc && ((buf - bp) + 1024) > 2; i++) {
+       for (i = 0; i < argc && ((buf - bp) + BUFSIZ) > 2; i++) {
                if (i != 0) {
                        *bp++ = ',';
                        *bp++ = ' '; 
                }
-               bp = requote(bp, argv[i], (buf - bp) + 1024);
+               bp = requote(bp, argv[i], (buf - bp) + BUFSIZ);
        }
        *bp = '\0';
        com_err(whoami, 0, "%s", buf);
@@ -111,7 +105,7 @@ char **argv;
     register unsigned char *p, *lastch;
 
     for (arg = argv; argc--; arg++) {
-       for (lastch = p = *arg; *p; p++) {
+       for (lastch = p = (unsigned char *) *arg; *p; p++) {
            /* If any byte in the string has the high bit set, assume
             * that it is binary and we do not want to trim it.
             * Setting p = lastch will cause us not to trim the string
This page took 0.068607 seconds and 4 git commands to generate.