Changeset 3568


Ignore:
Timestamp:
Jul 9, 2022, 3:24:31 PM (3 years ago)
Author:
bird
Message:

kash: Corrected has_ext for when suffix is set via the suffix index in shellexec. Removed bogus assertion from tryexec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/exec.c

    r3480 r3568  
    235235                        memcpy(cmdname, argv0, argv0len);
    236236                        memcpy(cmdname + argv0len, g_exe_suffixes[suffix], sufflen + 1);
     237                        tryexec(psh, cmdname, argv, envp, 1);
    237238                } else
    238239#endif
     
    240241                        cmdname = stalloc(psh, argv0len + 5);
    241242                        memcpy(cmdname, argv0, argv0len + 1);
    242                 }
    243                 tryexec(psh, cmdname, argv, envp, has_ext);
     243                        tryexec(psh, cmdname, argv, envp, has_ext);
     244                }
    244245                TRACE((psh, "shellexec: cmdname=%s\n", cmdname));
    245246                stunalloc(psh, cmdname);
     
    263264                        if (--idx < 0 && psh->pathopt == NULL) {
    264265#ifdef PC_EXE_EXTS
    265                                 if (!has_ext && idx == -1 && suffix && (unsigned)suffix < K_ELEMENTS(g_exe_suffixes))
     266                                if (!has_ext && idx == -1 && suffix && (unsigned)suffix < K_ELEMENTS(g_exe_suffixes)) {
    266267                                        strcat(cmdname, g_exe_suffixes[suffix]);
    267 #endif
    268                                 tryexec(psh, cmdname, argv, envp, has_ext);
     268                                        tryexec(psh, cmdname, argv, envp, 1);
     269                                } else
     270#endif
     271                                        tryexec(psh, cmdname, argv, envp, has_ext);
    269272                                if (errno != ENOENT && errno != ENOTDIR)
    270273                                        e = errno;
     
    305308        if (!has_ext) {
    306309                int suffix;
    307                 int isreg = stat_pc_exec_exts(psh, cmd, 0, &suffix);
    308                 kHlpAssert(isreg > 0);
     310                stat_pc_exec_exts(psh, cmd, 0, &suffix);
    309311        }
    310312#endif
Note: See TracChangeset for help on using the changeset viewer.