Add spaces when catenating chronyc command line arguments

This commit is contained in:
Miroslav Lichvar 2009-11-12 16:48:09 +01:00
parent e08870c63c
commit 0a86a8dd0b

View file

@ -2377,13 +2377,15 @@ process_args(int argc, char **argv)
total_length = 0; total_length = 0;
for(i=0; i<argc; i++) { for(i=0; i<argc; i++) {
total_length += strlen(argv[i]); total_length += strlen(argv[i]) + 1;
} }
line = (char *) malloc((2 + total_length) * sizeof(char)); line = (char *) malloc((2 + total_length) * sizeof(char));
line[0] = 0; line[0] = 0;
for (i=0; i<argc; i++) { for (i=0; i<argc; i++) {
strcat(line, argv[i]); strcat(line, argv[i]);
if (i + 1 < argc)
strcat(line, " ");
} }
strcat(line, "\n"); strcat(line, "\n");