diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2021-08-24 19:21:53 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2021-08-24 19:21:53 +0100 |
commit | 4a9437317fd374e983934d5b18c7d1d6ee041645 (patch) | |
tree | c4766c879ade6e8c20d9fab3bfa9fe00c515217f | |
parent | cd89e1937daa9dcfa6b372ec56018904c0f34581 (diff) | |
download | zsh-4a9437317fd374e983934d5b18c7d1d6ee041645.tar.gz zsh-4a9437317fd374e983934d5b18c7d1d6ee041645.tar.xz zsh-4a9437317fd374e983934d5b18c7d1d6ee041645.zip |
49297 (quoting amended): error message in files module.
If ENONENT it could be the other argument that doesn't exist, so check.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/Modules/files.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 3d1a97e41..428998717 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-08-24 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 49297 with quoting updated: Src/Modules/files.c: check + which files is in error when ENOENT on link etc. + 2021-08-24 dana <dana@dana.is> * github #78: DCsunset: Completion/Unix/Command/_pandoc: Fix diff --git a/Src/Modules/files.c b/Src/Modules/files.c index a1d6f6bf2..d991f69d7 100644 --- a/Src/Modules/files.c +++ b/Src/Modules/files.c @@ -346,7 +346,13 @@ domove(char *nam, MoveFunc movefn, char *p, char *q, int flags) unlink(qbuf); } if(movefn(pbuf, qbuf)) { - zwarnnam(nam, "%s: %e", p, errno); + int ferrno = errno; + char *errfile = p; + if (ferrno == ENOENT && !lstat(pbuf, &st)) { + /* p *does* exist, so error is in q */ + errfile = q; + } + zwarnnam(nam, "`%s': %e", errfile, ferrno); zsfree(pbuf); return 1; } |