tools/mkdeps.c: Fix error in calculation of the length of the command

This commit is contained in:
Gregory Nutt
2016-01-10 11:15:30 -06:00
parent 76f4c2bf20
commit 65826c7f21

View File

@@ -663,7 +663,9 @@ static void do_dependency(const char *file)
{
const char *expanded;
cmdlen += strlen(g_cflags);
expanded = do_expand(g_cflags);
cmdlen += strlen(expanded);
if (cmdlen >= MAX_BUFFER)
{
fprintf(stderr, "ERROR: CFLAG string is too long [%d/%d]: %s\n",
@@ -671,7 +673,6 @@ static void do_dependency(const char *file)
exit(EXIT_FAILURE);
}
expanded = do_expand(g_cflags);
strcat(g_command, expanded);
}