From 4a9437317fd374e983934d5b18c7d1d6ee041645 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 24 Aug 2021 19:21:53 +0100 Subject: 49297 (quoting amended): error message in files module. If ENONENT it could be the other argument that doesn't exist, so check. --- ChangeLog | 5 +++++ Src/Modules/files.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3d1a97e41..428998717 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-08-24 Peter Stephenson + + * 49297 with quoting updated: Src/Modules/files.c: check + which files is in error when ENOENT on link etc. + 2021-08-24 dana * 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; } -- cgit 1.4.1