fix wrong sign in infinite loop commit

This commit is contained in:
IoIxD 2026-01-26 18:21:43 -07:00
commit 88ac663421

View file

@ -177,7 +177,7 @@ static int do_exec(msh_lexer *lexer, char *cmd, char **args, int *n,
/* loop through all the path entries and check if the file exists in them. /* loop through all the path entries and check if the file exists in them.
*/ */
i = 0, *n = 0, j = 0; i = 0, *n = 0, j = 0;
while (j >= lexer->path_count) { while (j <= lexer->path_count) {
full_path[*n] = lexer->path[j]; full_path[*n] = lexer->path[j];
*n += 1; *n += 1;
if (lexer->path[j] == '\0') { if (lexer->path[j] == '\0') {
@ -186,7 +186,8 @@ static int do_exec(msh_lexer *lexer, char *cmd, char **args, int *n,
full_path[i + *n] = cmd[i]; full_path[i + *n] = cmd[i];
} }
*n += i; *n += i;
full_path[*n++] = '\0'; full_path[*n] = '\0';
*n += 1;
if (msh_path_exists(full_path)) { if (msh_path_exists(full_path)) {
msh_execute(full_path, args); msh_execute(full_path, args);