[PATCH setup 8/9] Fix useless error message
Jon Turney
jon.turney@dronecode.org.uk
Tue Jun 6 11:55:00 GMT 2017
If source.Cached() is empty, we produce the amazingly helpful error message
"Can't open (null) for reading: No such file".
Improve the error message so it reports that we can't open the archive since
we don't know a filename for the locally cached archive file.
This can occur if download failed for an archive, but we chose to continue.
---
install.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/install.cc b/install.cc
index 79ddd20..f8f0b59 100644
--- a/install.cc
+++ b/install.cc
@@ -366,7 +366,14 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
io_stream *pkgfile = NULL;
- if (!source.Cached() || !io_stream::exists (source.Cached ())
+ if (!source.Cached())
+ {
+ note (NULL, IDS_ERR_OPEN_READ, source.Canonical (), "Unknown filename");
+ ++errors;
+ return;
+ }
+
+ if (!io_stream::exists (source.Cached ())
|| !(pkgfile = io_stream::open (source.Cached (), "rb", 0)))
{
note (NULL, IDS_ERR_OPEN_READ, source.Cached (), "No such file");
--
2.12.3
More information about the Cygwin-apps
mailing list