mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
SHOPT_SPAWN: Fix 'not found' error message inconsistency
There's an annoying inconsistency in error messages if ksh is compiled with SHOPT_SPAWN. One way to trigger it: $ /usr/local/bin/ksh -c '/tmp/nonexistent' /usr/local/bin/ksh: /tmp/nonexistent: not found $ /usr/local/bin/ksh -c '/tmp/nonexistent; :' /usr/local/bin/ksh: /tmp/nonexistent: not found [No such file or directory] In the first variant, as an optimisation, ksh went straight to exec'ing the command without forking first. In the second variant, sh_ntfork() was used. The first variant is done in path_exec(), path.c, line 1049: errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_found,arg0); The second one is in sh_ntfork(), xec.c, line 3654: errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4); In both cases, the e_found message is only used if errno==ENOENT, so the extra '[No such file or directory]' message generated by ERROR_system() is pointless as that will never change for that message. src/cmd/ksh93/sh/xec.c: sh_ntfork(): - Use ERROR_exit() instead of ERROR_system() for the e_found message to avoid the superfluous addition.
This commit is contained in:
parent
2e5b625915
commit
ecf260c282
1 changed files with 1 additions and 1 deletions
|
@ -3631,7 +3631,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in
|
||||||
if(spawnpid < 0) switch(errno=shp->path_err)
|
if(spawnpid < 0) switch(errno=shp->path_err)
|
||||||
{
|
{
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4);
|
errormsg(SH_DICT,ERROR_exit(ERROR_NOENT),e_found+4);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
default:
|
default:
|
||||||
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
|
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
|
||||||
|
|
Loading…
Reference in a new issue