This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 8/9] Fix useless error message
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Tue, 6 Jun 2017 12:54:31 +0100
- Subject: [PATCH setup 8/9] Fix useless error message
- Authentication-results: sourceware.org; auth=none
- References: <20170606115432.105020-1-jon.turney@dronecode.org.uk>
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